Skip to Content

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

Aug 12, 2017 at 08:41 AM


avatar image

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?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Ian Waterman Aug 14, 2017 at 07:39 AM

You need to use a Shared Variable.

Declare in formula with this structure


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.


Show 3 Share
10 |10000 characters needed characters left characters exceeded

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.



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.


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.