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

Conditional data linking yields "wrong" results

Status
Not open for further replies.

Pete56

Programmer
Aug 29, 2001
39
0
0
US
Tools: Crystal 10 | ODBC data access to DBF files
2 files: Patient file and insurance file linked by pat #
1 record per patient
1+ records per patient with rank field identifying order
Problem: I want to link on patient number and only include the primary insurance number. I set a selection to include only records in the insurance file that are rank=1. This excludes all of the patients that do not have any insurance records.

Question: How can I include all of the patients on a report and their primary insurance (if they have it) and exclude all of the secondary, tertiary, etc. insurances.

2nd Question: How would I include the primary and secondary and none of the others.

I was using the insurance file twice with different selection but have realized that the patients with no insurance are excluded and that isn't ok.

Thanks in advance.

Pete
pete@rock-pond.com
 
It sounds like you want all patients, and those that have the rank = 1.

You might need a subreport, with the main report grouped by the patient, linked to the main report and returning the insurance info in the subreport selection criteria when the rank = 1.

There are alternatives, and I rarely suggest a subreport, and the best alternative would be to create a data source within the xBase application to return the proper rows.

-k
 
Use a left join FROM the patient table to the insurance table, and do not use selection criteria based on insurance table fields. Instead, go to the section expert->details->suppress (WITHOUT checking "suppress")-> enter:

{insurance.rank} > 1

Or, if you want to show the top 2, then use:

{insurance.rank} > 2

Be sure to also check "suppress blank section".

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top