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

Displaying ONLY most recent result

Status
Not open for further replies.

chefty1

Programmer
Jan 17, 2012
4
US
We have a table in Crystal that displays the lab results for patients. Sometimes certain labs are drawn and reported multiple times a day. I'd like to only have the most recent result display on my report. Is there a formula that can help me do this? Thanks!
 
Chefty1,

Depending on the structure of your data, you could suppress detail-rows where Field 'X' is not equal to the Max(Field "X") on the group.

A matter of determining what defines the "most current" result and suppressing all those which do not fit the criteria.

Note: I *think* suppression is your only option, as to limit by a Maximum, the entirety of the group must be reported -- to this end, basic Totals and such may mis-report as they will still tally the supressed records. Circumvent this with contitional formulas and then summarize these Formulas.

Hope this helps, cheers!


Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
I'm guessing there might be multiple types of tests per patient per day, so you might want to group #1 on {table.datetime} on change of day, group #2 on patient, and then group #3 on testtype.You can suppress all group headers/footers if you wish, and just display the detail record returned by the following.

Go to report->selection formula->GROUP and enter:

{table.datetime} = maximum({table.datetime},{table.testtype})

This method is better than suppression in the sense that you can insert running totals on the displayed results and they will ignore the non-displayed records (which are still IN the report, though not displayed). With suppression, you would have to explicitly remove the records in an evaluation formula in the running total.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top