cancel
Showing results for 
Search instead for 
Did you mean: 

how can i take a sub report value to the main report.

steverdan
Participant
0 Kudos

I have created a sub report and I want to know two things. Can I bring that value to the main report and if so how?
Second, Can I use that value as part of the select formula?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

You need to use a Shared Variable.

Declare in formula with this structure

Whileprintingrecords;

Shared Numbervar X;

Can be string boolean or date.To carry data from Subreport to main report the main report formula must be in a section below the subreport.

Subreports are evaluated after main report that is while you use whileprintingrecords. Such formula can not be used in Select filters.

If you want to use variable you will need to to convert data source to a Stored Procedure and then do all work including Subreport data in SQL.

Ian

Former Member
0 Kudos

Another possibility is to approach report differently.

Make your subreport the main report and vice versa. You can then pass info to what was the main report which accesses the select statement by using a subreport link. What ever field/formula you want in to filter report forms part of the links to the subreport.

Ian

steverdan
Participant
0 Kudos

what if the value I want to bring to the main report is a string?

Also, can invert the reports due to all of the other sub reports.

Former Member
0 Kudos

Shared vars can be strings to

Data from Shared Vars can only be shown after the SR has excecuted.

If you want a summary at top of report you can load subreports twice, hide version generating vars in Report header.

and then place again in lower part of report to display details.

Hidden SRs must be in an open section otherwise they will not execute, simply suppress all SR sections and make them as thin as possible so they do not take up much space, you can also set section to underlay following sections. This way they will not affect layout but they will use DB resource as you will be running twice.

Ian