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

If table.field contains Array1 then display Array1 and Array2

Status
Not open for further replies.

tellamugali

Technical User
Joined
Oct 18, 2006
Messages
11
Location
AU
G'day All,

I am using Crystal Reports 9 to query a Laboratory Information system. Database is Intersytems Cache' connection is via an ODBC System DSN Data Source using Intesystems ODBC 4.00.836.00 driver as the LIS uses FDBMS.

I need to filter my report to only display a specific result so I am using the below formula.

eg: {table.result_field} in ["A","B","C"]

Now the client has asked that if the test was positive for one of the above results and there was also an "X","Y" or "Z" detected for that episode to include it.

I cannot just add ["X","Y","Z"] to the array because I will then get tests that had only an "X","Y" or "Z" and the client requires it to be either ["A","B","C"] or at least one ["A","B","C"] and an "X","Y"or"Z"

I apologise if this is a no-brainer but I have not been able to crack it or enter the appropriate search criteria to find a thread that would help.

regards
tellamugali
 
Let's clarify. Are you selecting just records with the field equal to A or B or C?

Now is there an extra conditon, there must be at least one record in A, B and C and also at least one record in X, Y or Z?

If that's it, then you can't do it by selection alone. Select A, B, C, X, Y and Z. Group. Suppress group details and group header. Add a pair of running total counts, one to work for A or B or C, the other for X, Y or Z. Use section formatting to suppress unless both of the counts are non-zero.

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


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
You would have to change your record selection to:

{table.result_field} in ["A","B","C","X","Y","Z"]

Insert a group on {table.episode}. Then create a formula {@ABC}:

if {table.result_field} in ["A","B","C"] then 1

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

sum({@ABC},{table.episode}) > 0

If you need to to calculations across groups, you would have to use running totals, since non-group selected records would contribute to the more usual inserted summaries.

-LB
 
Thanks Madawc and lbass,

I went with lbass's solution as it was a given (no thought required). I have read the FAQ and understand the logic behind this solution.

Many Thanks
tellamugali

"Buy a man a fish and you feed him for the day. Teach him to fish and you feed him for life.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top