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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Storing Values from the First Record in a Group 1

Status
Not open for further replies.

bpngo

Technical User
Jun 18, 2001
11
US
I would like to save the values from the first detail record in a group so that I can compare the data in the next 2nd, 3rd, 4th, etc detail records to the saved data from the 1st record. When the group changes, I want to repeat the process. The group is patient name.

Patient Date Doctor
Rec 1 John Doe 02/02/2012 X <---this is the data I want to store.
Rec 2 John Doe 01/04/2012 X
Rec 3 John Doe 12/22/2012 Y
Rec 4 John Doe 11/12/2012 X

Data saved is: John Doe 02/02/2012 X
I can now compare the Doctor from the 1st record to the doctor from the 3rd record to see that they are different. When the group changes, the data in the first record of the next group will be stored.

Group change:
Rec 1 Mary Jane 2/6/2012 A <---this is the stored data
Rec 2 Mary Jane 12/13/2012 X
Rec 3 Mary Jane 12/01/2012 A


Thanks in advance.

Brian
 
So you are grouping on patient. If you really only want to compare doctors, then you can set this up like this, after sorting on date descending:

whileprintingrecords;
stringvar doc;
if onfirstrecord or
{table.patient} <> previous({table.patient}) then
doc := {table.doctor};

You can then reference this in later records:

whileprintingrecords;
stringvar doc;
if {table.doc} <> doc then
"Different" else
"Same"

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top