| Author |
Message |
rshardha
Newbie
Joined: 12 May 2014
Online Status: Offline
Posts: 2
|

Topic: Filtering data Posted: 16 May 2014 at 5:07am |
|
Hi,
I'm new to this forum as well to crystal reports. I've created a basic healthcare report which extracts data for the patients whose age is 18+. In the output it shows patient's name, blood pressure and date blood pressure was recorded. The report shows all the blood pressure for the patient on file. I want to see only the latest blood pressure (based on the date blood pressure is taken on). Example:
John Smith 9/5/2012 120/75
John Smith 3/4/2013 130/85
John Smith 5/5/2014 125/70
Some of the patients might have latest blood pressure blank (with a date). In that case I want the blood pressure before that
Some of the patients might have no blood pressure records. In that case the report should show the blank - so that we know that this patient is missing blood pressure record.
Hope to find the solution on this forum...
Regards.
|
IP Logged |
|
|
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 16 May 2014 at 5:20am |
|
going from the point where the report is showing all the records, I would add a group by patient and sort by the date of the blood pressure reading, descending. This will give most of what you want.
The trick would be the where the data is blank, but on a prior date they had a recorded blood pressure...I would work on crafting a formula that would show that...but if the next row is also blank, then will be out of luck with the standard formulas...which would mean a subreport (and they are bad for performance as they generate lots of hits to the database)
You would have to review your data to see if you could use the NEXT() function in CR to get the blood pressure reading. The caveat with NEXT is that it ignores group boundaries and you would need to check that the patient has not changed as well.
Look at the report once you have the grouping in place and see if you can get the data that you want to display in the Group Header line. Once you can, suppress the details of the report, and only display the group header, and your report is done.
HTH
|
IP Logged |
|
rshardha
Newbie
Joined: 12 May 2014
Online Status: Offline
Posts: 2
|

Posted: 16 May 2014 at 5:40am |
|
Thanks for the quick response. I've grouped the data by patient name (one column showing last name+""+ first name). Within that group the data has been arranged in descending order so that the BP recordings for each patient is on top in each group.....how do I proceed from here now? Also if there is a way to do a count of groups where there is no BP recorded at all?
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 16 May 2014 at 5:46am |
|
for counting you would need a formula with a shared variable:
The incrementing would be a formula like: placed in the group header
shared numbervar nobp;
if {table.bloodpressure} = "" then //or however the data is displayed
nobp := nobp +1;
"" // will hide the output of the formula
another formula is needed to display the results, place in the report footer, perhaps:
shared numbervar nobp
if the display of the data is acceptable to you, right click on the details section and select Hide or Suppress. That should do it. Any data that you need for the patient should be in the group header section.
HTH
|
IP Logged |
|
|
|