cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Selection Results to Subreports

Former Member
0 Kudos

Hi

I'm sure that this is a stupid question But If I have carried out a selection query in my main report which returns say 1000 postcodes how can I pass these to t a subreport to select the same 1000 postcodes? By linking the fields that contains the postcodes the parameter created only contains the first postcode.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi James,

Try creating a formula like

@Initialize:

WhilePrintingRecords;
stringVar str:="0";

Place this formula in report header

Now create another formula like

@Evaluate:

WhilePrintingRecords;
stringVar str;
str:=str+","+totext({PostCode});

Now create a command in the subreport like

select * from table where postcode in ({?StringParameter})

Now place the subreport in report footer and link the command level parameter from subreport ({?StringParameter}) with formula @Evaluate

Now the subreport results uses all the passcodes from main report.

Regards,

Raghavendra

Answers (3)

Answers (3)

Former Member
0 Kudos

Cheers that worked perfectly

Former Member
0 Kudos

So if you have a postal code in each row (each one different) and your sub-report is also in the Details section simply do a sub-report link on postal code and it will display the sub-report for each.

(don't really recommend putting sub-reports into a details section - detrimental to report efficiency)

Former Member
0 Kudos

if your subreport is dependant on varying poscode values then it'll have to be included at the same level as your main report postcode value (ie detail level) and it'll run once for every value (that'll be 1000 times!)

it make take time to run but if that's what your report requires so be it!

cheers,

dom

Former Member
0 Kudos

is the subreport in the details section?

so if each postcode in the main report is held in the details section a corresponding subreport held in that detail row should do the trick!

Dom