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

Add multiple entries from subreport to report

Status
Not open for further replies.

mvalley

Technical User
Mar 4, 2011
80
US
I have a subreport with the following formula:
if({stock.stk_number}="07995")then "ANCONT" else
If({stock.stk_number}="05337") then "ANNERVE"

I am trying to capture this information based on patient charges. Some patient’s meet both criteria, therefore they show up twice on the report, once with ANCONT and again with ANNERVE. How can I have both of these responses populate on the same line showing the patient name only once? I have tried suppressing duplicate names, but I still have 2 lines.
 
Add a formula to the detail section of the sub like this:

whileprintingrecords;
stringvar x := x + {@yourformula}+", ";

In the sub footer, use this formula to display the results:

whileprintingrecords;
stringvar x;
if len(x)> 2 then
left(x, len(x)-2)

Suppress all sub sections except the report footer. This assumes the sub is linked to the main report on the patient field.

-LB
 
Sorry, I forgot to mentioned that the subreport was created because the fields do not link to the main report. The information pulls correctly with the subreport, I just want it all on 1 line if both ANCON and ANNERVE exist (which does not happen with every record, maybe 1 out of 10) instead of showing all the same information on a separate line with ANCONT on 1 line and ANNERVE on the next line.
 
In what main report section is the subreport located?

-LB
 
subreport located in the detail section of the main report
 
This makes no sense if it is an unlinked report. If you have linked it to the main report, identify the fields you are linking on.

-LB
 
Subreport has fields from a stock table.

Main report has the table case-record_billing_queue_crbq_stock_urn.
I am linking the subreport based on the stock_stk_urn field.

My report looks right, meaning when result is ANCONT it is on one line. If criteria for both ANCONT and ANNERVE is met, I have 2 lines with the same information except 1st line shows ANCONT and second line shows ANNERVE with all other fields in the main report showing all information (ie case number, name,surgeon,procedure,date)

I am hoping there is a way to trigger both ANCONT and ANNERVE to show up on the same line if both criterias are met so that the rest of the data does not populate on the next line
 
Did you try my suggestion? It should work. You can add a reset formula in the report header of the sub:

whileprintingrecords;
stringvar x := "";

-LB
 
While trying your suggestions, and adding the formula to the detail section of the subreport, I encounter the following error message:

stringvar x: =
(highlighted error part)x + {@tpk_name}+”,”: “A string can be at most 65534 characters long.”

My report has 8 names, 2 names have both ANCONT and ANNERVE
 
Are you getting duplicate records? Did you add the reset formula?

-LB
 
Answer is YES to both, however I was able to creat a different report that pulls the information I need that appears to work. Thank you for all your suggestions. I will file them in case I need them at a future day. Thank you for taking the time to work with me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top