Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Formula: Old/New Values, show both if different

Status
Not open for further replies.

loveyoursite

Technical User
Apr 14, 2005
100
0
0
US
I would greatly appreciate any formula recommendations for the following.
CRV10 - I have a table with the following fields: WF.OLD_DEPT, WF.NEW_DEPT, WF.OLD_PL, WF.NEW_PL, etc.
There will always be an old and a new value and sometimes those values will be the same for an employee.
In my report I want to show only those records where the "new" value is different from the "old" value AND if there is a difference, I need to show both the old and the new values. For example:

Employee: 8907
WF.OLD_DEPT 7161
WF.NEW_DEPT 7161
WF.OLD_PL 9827
WF.NEW_PL 9101

Employee: 7189
WF.OLD_DEPT 2323
WF.NEW_DEPT 8907
WF.OLD_PL 6529
WF.NEW_PL 1058

The report will show:
Employee Old Dept New Dept Old PL New PL
8907 9827 9101
7189 2323 8907 6529 1058
 
it can be done like this. Create a formula and place it in details section (or where ever you want to evaluate the values) -

WhilePrintingRecords;
StringVar old_val := ' ';
StringVar new_val := ' ';

if old_dept = new_dept then
' '
else
old_val := old_dept;
new_val := new_dept;

Then create 2 more formula's to display this variables like -
WhilePrintingRecords;
StringVar old_val;

Similarly for new_val;

HTH
 
Oops - so sorry - I left something out. I'll back up. In the table, there is a field called WF.Variable_Name populated with text; old_dept and new_dept and old_pl and new_pl. There is another field WF.Variable_Value that contains the actual value. For example:

WF.Variable_Name WF.Variable_Value
Old_Dept 7161
New_Dept 7161
Old_PL 9827
New_PL 9101

I need the report to show:
Employee Old Dept New Dept Old PL New PL
8907 9827 9101
7189 2323 8907 6529 1058
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top