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

Help with 'Next Record'

Status
Not open for further replies.

Phillipg

Technical User
May 3, 2002
53
0
0
US
I have a report that the main table is linked to another table and that table is linked yet to another table.
Table 1 (main table) is linked from {Incident.ID} to {IncPatientCondition.IncidentID} and that table is linked from {IncPatientCondition.ConditionID} to {MedicalHistoryConditions.ID}. The last table has a field in it as {MedicalHistoryConditions.Descriptions} that I need the values from.
What I wold like to do is to have one row with all of the {MedicalHistoryConditions.Descriptions} associated with the first table. At present, all that I can do is have that report print multiple times with one {MedicalHistoryConditions.Descriptions} on each page. My report has multiple detail sections in it, with one of those sections being the {MedicalHistoryConditions.Descriptions} field. No groups in this report.

Crystal Reports 9
Oracle database

Any help will be appreciated.
Thanks


Phillipg
 
Group by the description and place the description in the group header and suppress the details.

This is a wild guess, for more tailored assistance, post additional technical information:

Example data
Expected output

Hope this helps.

-k
 
My report is mainly comprised of fields from the {Incident} table. The second table ({IncPatientConditions}) has an entry of the {Incident.ID} for every {IncPatientCondition.ConditionID} that was selected. The third table ({MedicalHistoryCondition}) has a field for the {IncPatientCondition.ConditionID} as the ID of that table. In that table is a field “Description” that holds values assigned to the ID field. I am not positive of this structure. When the main table is generated, a record is generated for each {IncPatientCondition.ConditionID} in the table {IncPatientConditions}.
This table may look like this:
[tt]Incident.ID ConditionID
80213 138
80213 139
80213 215
80214 138
80214 358
80215 139[/tt]
and so on.

The third table, ({MedicalHistoryCondition}) holds the “description” of the ConditionID.
This table may look like this:
[tt]
ConditionID Description
138 Cardiac
139 Vascular
215 Respiratory
358 No Medical History
[/tt]
They are fifteen ConditionID’s and description’s in this table

When I print a report and try to include the descriptions. It prints an additional page for each description.
I have multiple detail sections in this report.
What I would like to do, is to put the Medical History descriptions on one row in the report, like:

[tt]
Detail A Name: John Doe
Address: Home
CSZ: Anytown, AnyState, 12345
Detail B Med HX: Cardiac, Vascular, Respiratory
Detail C Allergies: None
[/tt]
Hope this helps, Thanks


Phillipg
 
Your output example doesn't show 358 (No Medical History), why is this?

You would be best served to show the output example from the data as it's joined in the report, not what is in the tables.

I wouldn't use detail sections, I'd group by the Incident, and then suppress the group header and the details, and then place the fields in the group footer, including something like:

Group Header Formula:
whileprintingrecords;
stringvar Descrips:= ""

Details section formula (remember that this section is suppressed):
whileprintingrecords;
stringvar Descrips:= "";
if instr(descrips,{table.field}) > 0 then
Descrips:=Descrips+{table.field}+", ";

Group Footer Formula:
whileprintingrecords;
stringvar Descrips;
left(Descrips,len(Descrips)-2)

-k
 
Im brain dead on this.
The report i called up did not have the ConditionID 358 in the table {IncPatientConditions}. When the {Incident} record is generated, it creates a record in the {IncPatientConditions} table. It includes the {IncidentID}, {ConditionID} fields. For each {ConditionID} that is selected in the {Incident} record, it creates a record for that {ConditionID} in the {IncPatientConditions} table.
that is why my list showed:
Incident.ID ConditionID
80213 138
80213 139
80213 215
80214 138
80214 358
80215 139
and so on.


Phillipg
 
I was basing my question on your example data and the resultant report.

As I stated before, rather than showing what is in the table, show example data of the joined tables, and your expected output.

Did you try my suggestion?

-k
 
SV-

I think you probably meant your detail level formula to be the following, removing the reset for Descrips and changing the sign on the instr() function:

Details section formula (remember that this section is suppressed):
whileprintingrecords;
stringvar Descrips;
if instr(descrips,{table.field}) = 0 then
Descrips:=Descrips+{table.field}+", ";

-LB
 
Details section formula (remember that this section is suppressed):
whileprintingrecords;
stringvar Descrips:= "";
if instr(descrips,{table.field}) > 0 then
Descrips:=Descrips+{table.field}+", ";

Ooops, the ole copy and paste got me, and I'm not sure why I went with >...thanks LB.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top