cancel
Showing results for 
Search instead for 
Did you mean: 

Pass a value from sub report to main report

ginger_fabricius
Explorer
0 Kudos

I have a sub report that totals hours per patient. I have a main report that displays other data per patient. I would like to pass the total hours and display it on each patient.

For ex: Patient 1 in sub report has a total of 40 hours. In the main report, that patients room and id are listed. On that same line, I would like the total hours from the subreport for that patient 1 to display on the same line in the main report with the room and id.

Patient 2 in subreport has 33 hours, in the main report I would like that value displayed.

I have this formula in the subreport detail line:

Whileprintingrecords;
Shared Numbervar restraintot:= {Command.RESTRAINT_TIME_DAYS}

I have this formula in the main report:

Whileprintingrecords;
Shared Numbervar restraintot;
Restraintot;

The subreport on the mainreport is in the pageheader line.On the groupheader1 line I put the formula field.

It is only displaying 0.00

Please help!

Accepted Solutions (0)

Answers (2)

Answers (2)

DellSC
Active Contributor
0 Kudos

You have the subreport in the page header. Is there one page per patient? How does the subreport know which patient to use?

Also, is the subreport suppressed? If so, then it won't run. instead, you'll need to do this:

1. Right-click on the subreport, go to Format... and turn off "Can Grow".

2. Make sure there is nothing placed in the top left of the first unsuppressed section in the subreport.

4. Place the formula field that you mention above in the subreport so that it will get evaluated. Don't put it in the top left.

3. In the main report, make the subreport as small as you can get it. This will set things up so that the subreport will run but it won't actually display anything.

If that doesn't work, let me know and I'll see what else I can come up with.

-Dell

former_member292966
Active Contributor
0 Kudos

Hi Ginger,

Put the subreport in the Group Header and link it to the patient.

Add a new section in the Group Header, below the subreport and put your formula to display the hours.

Good luck,

Brian