Wednesday, July 1, 2009

Copy Fields for Jocelyn

Here's what the Calculated Fields section looks like for the Direct Deposit Earnings Statement:
This to answer Jocelyn's question on Copying calculated fields.

CalculatedFields
{
CalculatedField "SickAvail"
{
EvaluateAfter ""
Expression " ( 'UPR_WORK_Check'.'Sick Time Available' - 'UPR_WORK_Check'.'Sick Time Hours' ) * 0.01000 "
ResultType "Currency"
}
CalculatedField "VacAvail"
{
EvaluateAfter "SickAvail"
Expression " ( 'UPR_WORK_Check'.'Vacation Available' - 'UPR_WORK_Check'.'Vacation Hours' ) * 0.01000 "
ResultType "Currency"
}
CalculatedField "Sick Time Total"
{
EvaluateAfter ""
Expression " ( 'UPR_WORK_Check'.'Sick Time Available' - 'UPR_WORK_Check'.'Sick Time Hours' ) * 0.01000 "
ResultType "Currency"
}
CalculatedField "Vacation Time Total"
{
EvaluateAfter "Sick Time Total"
Expression " ( 'UPR_WORK_Check'.'Vacation Available' - 'UPR_WORK_Check'.'Vacation Hours' ) * 0.01000 "
ResultType "Currency"
}

Copy Calculated Fields in Report Writer

Yes you can! The secret is in the editing of the .package file.

Let's imagine you want to use the rw_SelectAddrLine user-defined function to create the address block in the SOP Blank Invoice Form. KB (862653) entitled "Description of the rw_SelectAddrLine Report Writer function" will show you that 9 calculated fields could be required if you want to use all of the available fields in the address block. If you like going through that drill, the process definitely works.

I prefer the copy and paste method. What you need to do is create a couple of the calculated fields as directed in the article and then export the modified report to a .package file. Open the package file using the text editor of your choice and then copy and past until you have what you need. For the SOP Blank Invoice Form here is the text you can past into the calculated field portion of your report.

The calculated fields below skip the 'Name' field (the first variable)
CalculatedField "Ship To Address Line 1" { EvaluateAfter "" Expression "'rw_SelectAddrLine'( 1 \"\" 'SOP_HDR_WORK'.'Contact Person''SOP_HDR_WORK'.'Address 1''SOP_HDR_WORK'.'Address 2''SOP_HDR_WORK'.'Address 3''SOP_HDR_WORK'.'City''SOP_HDR_WORK'.'State''SOP_HDR_WORK'.'Zip Code''SOP_HDR_WORK'.'Country' ) " ResultType "String" } CalculatedField "Ship To Address Line 2" { EvaluateAfter "" Expression "'rw_SelectAddrLine'( 2 \"\" 'SOP_HDR_WORK'.'Contact Person''SOP_HDR_WORK'.'Address 1''SOP_HDR_WORK'.'Address 2''SOP_HDR_WORK'.'Address 3''SOP_HDR_WORK'.'City''SOP_HDR_WORK'.'State''SOP_HDR_WORK'.'Zip Code''SOP_HDR_WORK'.'Country' ) " ResultType "String" } CalculatedField "Ship To Address Line 3" { EvaluateAfter "" Expression "'rw_SelectAddrLine'( 3 \"\" 'SOP_HDR_WORK'.'Contact Person''SOP_HDR_WORK'.'Address 1''SOP_HDR_WORK'.'Address 2''SOP_HDR_WORK'.'Address 3''SOP_HDR_WORK'.'City''SOP_HDR_WORK'.'State''SOP_HDR_WORK'.'Zip Code''SOP_HDR_WORK'.'Country' ) " ResultType "String" } CalculatedField "Ship To Address Line 4" { EvaluateAfter "" Expression "'rw_SelectAddrLine'( 4 \"\" 'SOP_HDR_WORK'.'Contact Person''SOP_HDR_WORK'.'Address 1''SOP_HDR_WORK'.'Address 2''SOP_HDR_WORK'.'Address 3''SOP_HDR_WORK'.'City''SOP_HDR_WORK'.'State''SOP_HDR_WORK'.'Zip Code''SOP_HDR_WORK'.'Country' ) " ResultType "String" } CalculatedField "Ship To Address Line 5" { EvaluateAfter "" Expression "'rw_SelectAddrLine'( 5 \"\" 'SOP_HDR_WORK'.'Contact Person''SOP_HDR_WORK'.'Address 1''SOP_HDR_WORK'.'Address 2''SOP_HDR_WORK'.'Address 3''SOP_HDR_WORK'.'City''SOP_HDR_WORK'.'State''SOP_HDR_WORK'.'Zip Code''SOP_HDR_WORK'.'Country' ) " ResultType "String" } CalculatedField "Ship To Address Line 6" { EvaluateAfter "" Expression "'rw_SelectAddrLine'( 6 \"\" 'SOP_HDR_WORK'.'Contact Person''SOP_HDR_WORK'.'Address 1''SOP_HDR_WORK'.'Address 2''SOP_HDR_WORK'.'Address 3''SOP_HDR_WORK'.'City''SOP_HDR_WORK'.'State''SOP_HDR_WORK'.'Zip Code''SOP_HDR_WORK'.'Country' ) " ResultType "String" } CalculatedField "Ship To Address Line 7" { EvaluateAfter "" Expression "'rw_SelectAddrLine'( 7 \"\" 'SOP_HDR_WORK'.'Contact Person''SOP_HDR_WORK'.'Address 1''SOP_HDR_WORK'.'Address 2''SOP_HDR_WORK'.'Address 3''SOP_HDR_WORK'.'City''SOP_HDR_WORK'.'State''SOP_HDR_WORK'.'Zip Code''SOP_HDR_WORK'.'Country' ) " ResultType "String" } CalculatedField "Ship To Address Line 8" { EvaluateAfter "" Expression "'rw_SelectAddrLine'( 8 \"\" 'SOP_HDR_WORK'.'Contact Person''SOP_HDR_WORK'.'Address 1''SOP_HDR_WORK'.'Address 2''SOP_HDR_WORK'.'Address 3''SOP_HDR_WORK'.'City''SOP_HDR_WORK'.'State''SOP_HDR_WORK'.'Zip Code''SOP_HDR_WORK'.'Country' ) " ResultType "String" } CalculatedField "Ship To Address Line 9" { EvaluateAfter "" Expression "'rw_SelectAddrLine'( 9 \"\" 'SOP_HDR_WORK'.'Contact Person''SOP_HDR_WORK'.'Address 1''SOP_HDR_WORK'.'Address 2''SOP_HDR_WORK'.'Address 3''SOP_HDR_WORK'.'City''SOP_HDR_WORK'.'State''SOP_HDR_WORK'.'Zip Code''SOP_HDR_WORK'.'Country' ) " ResultType "String" }