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

How to combine different criteria 2

Status
Not open for further replies.

madsstiig

Technical User
Jun 11, 2008
50
DK
Hi. I'm trying to make a report on patients who have been involved in accidents and therefore have been examined in the ER.
I want to have only patients who have been CAT scanned AND have had an x-ray of their thorax in my report.
If only 1 procedure has been executed the patient should not be represented in the report.
Our table/view gives an entry for each procedure.
(This problem is very difficult to explain in short terms - especially in a foreign language and to people who are not familiar with medical jargon but I hope it's understandable).
Best regards Mads, Copenhagen - Denmark.
 
I assume you have a table of what's been done to them. Group those details by patient, suppressing the group header and detail lines. Have separate running totals for both "CAT scanned" and "an x-ray of their thorax". SHow the patient details in the group footer if both of the counts are non-zero.

If you're not already familiar with Crystal's automated totals, see FAQ767-6524.

You don't say whether you need to know what else has been done to the relevant patients. If you don't, then you could speed the report by selecting just for those two procedures. Selecting records is done by the server and always faster than read-and-suppress.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
First limit the report in the record selection formula to the two procedures:

{table.procedure} in ["CT Scan","Thorax X-Ray"]

Insert a group on {table.patient} and then go to report->selection formula->GROUP and enter:

distinctcount({table.procedure},{table.patient}) > 1

Note that if you then want to do calculations across patients, you must use running totals, since the more usual inserted summaries would include non-group selected records.

-LB
 
Hi.
I've tried your suggestion but we have a lot of x-ray rooms so I have to define where this Thorax x-ray has been taken.
I have tried to define the examinations as follows:

({VWDEPSTAT.RGTEXT} in "CT multitraume" and
{VWDEPSTAT.TYPETEXT} = "Akut" and
{VWDEPSTAT.BOOKDATE} in DateTime (2008, 01, 01, 00, 00, 00) to DateTime (2008, 12, 31, 00, 00, 00)) or
({VWDEPSTAT.DLOCATION} in 'R40' and {VWDEPSTAT.RGTEXT} in "Thorax" and
{VWDEPSTAT.BOOKDATE} in DateTime (2008, 01, 01, 00, 00, 00) to DateTime (2008, 12, 31, 00, 00, 00))

where RGTEXT is the examination,
TYPETEXT shows whether it's acute or scheduled (must be acute),
DLOCATION is the x-ray room and must be defined so I get only the thorax'es from the ER.

... then my brain stopped working ...
 
Some of your tests could be simpler, e.g.
Code:
Year({VWDEPSTAT.BOOKDATE}) = 2008
I'd also split the separate tests into formulas, e.g.
Code:
({VWDEPSTAT.RGTEXT} in "CT multitraume" and
{VWDEPSTAT.TYPETEXT} = "Akut"...
Put @CT with the unselected detail records: it will show True or False. Do the same for X-rays. That way you can fine-tune them before trying to use them for selection. Selection could be as simple as
Code:
@CT or @Xray
You can then use the same formulas in your running totals, just enter the name.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
I would set up the record selection formula like this. Not sure why you are using "in"--I think they should be "=":

(
(
{VWDEPSTAT.RGTEXT} = "CT multitraume" and
{VWDEPSTAT.TYPETEXT} = "Akut"
) or
(
{VWDEPSTAT.DLOCATION} = 'R40' and
{VWDEPSTAT.RGTEXT} = "Thorax"
)
) and
{VWDEPSTAT.BOOKDATE} in DateTime (2008, 01, 01, 00, 00, 00) to DateTime (2008, 12, 31, 00, 00, 00)

I also would not use the year() function as it will not pass to the SQL query.

I am unclear what issue you are still having. If you next created the group selection formula I suggested earlier, you should be all set.

-LB
 
Hi again - and thank you for all the help :)
HOWEVER ... it doesn't work yet.
But now I think I know part of 'why'.
When we book an examination there's a code for the examination type - In this case I use the referring text for that code {VWDEPSTAT.RGTEXT} (e.g. 'CT multitraume') but for each examination type there will be 1 or more subcodes {VWDEPSTAT.RESCODE}. In the examination 'CT multitraume it could be 'CT of the brain', 'CT of the thorax', 'CT of the abdomen' etc.
For the conventional x-rays the {VWDEPSTAT.RGTEXT} would often be 'Multitraume' and the {VWDEPSTAT.RESCODE} could be 'Thorax', 'Neck', 'Upper Limb', 'Pelvis' etc.
When I make a report of this type there will be an entry for each RESCODE but I’m only interested in the patients who have both an entry where ({VWDEPSTAT.RGTEXT}=“CT multitraume”) and an entry where ({VWDEPSTAT.RESCODE}=”UXRC00” and ({VWDEPSTAT.DLOCATION} = "R40").
The resulting number should be a count of patients that fits these circumstances.
Can this be done at all?
 
Please show sample data that includes these fields and also explain exactly what you mean when you say it doesn't work.

-LB
 
My real problem seems to be the fact that I don't get to use CR very often in my daily work (I often re-use old reports) - there are far to many other more important issues to take care of - so I'm not very skilled in creating new ones.
Btw ... How can I show you sample data?
Maybe what I don't get is how to enter the group formula
distinctcount({table.procedure},{table.patient}) > 1
I have one type of examination {VWDEPSTAT.RGTEXT} called "CT multitraume" and another called "Multitraume".
The first one I can (or actually have to) use as is but the second one I have to define more accurately so I need to use the {VWDEPSTAT.RESCODE}="UXRC00" and location ({VWDEPSTAT.DLOCATION} = "R40" to be sure I get the right thorax x-ray exams.
If I need to enter patient-IDs they're called {VWDEPSTAT.DID}.
I think there must some part(s) of your suggestions that I simply don't understand... :-(
 
... when I use your formula I get patients who have had CT or x-rays...
 
There are two steps to this. First the record selection formula and THEN the group selection formula. The following goes in report->selection formula->RECORD:

(
(
{VWDEPSTAT.RGTEXT} = "CT multitraume" and
{VWDEPSTAT.TYPETEXT} = "Akut"
) or
(
{VWDEPSTAT.DLOCATION} = 'R40' and
{VWDEPSTAT.RESCODE}="UXRC00"
)
) and
{VWDEPSTAT.BOOKDATE} in DateTime (2008, 01, 01, 00, 00, 00) to DateTime (2008, 12, 31, 00, 00, 00)

Then go to report->selection formula->GROUP and enter:

distinctcount({VWDEPSTAT.RGTEXT},{VWDEPSTAT.DID})

...assuming you have inserted a group on {VWDEPSTAT.DID}. This assumes that:

{VWDEPSTAT.DLOCATION} = 'R40' and
{VWDEPSTAT.RESCODE}="UXRC00"

...is sufficient to narrow the data to thorax x-ray which is represented by one value of {VWDEPSTAT.RGTEXT}.

-LB
 
... when you ask me to insert a group on {VWDEPSTAT.DID} does that mean then that I use the Group Expert and sort by {VWDEPSTAT.DID}?
If I do so I get an error telling me that 'The result of selection formula must be a boolean'...
 
To insert a group, go to insert->group and choose the field.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top