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

How to Pull a Value onto the Subreport from the Main

Status
Not open for further replies.

TheBig1980s

IS-IT--Management
Jun 11, 2007
60
My main report is an inventory report that prints data based on fiscal periods where "PERIOD 1" = March, "PERIOD 2" = April, "PERIOD 3" = May, etc. The main report shows this fiscal data, based on a parameter chosen by the end user when the report is refreshed.

So, if the user choose "PERIOD 2", only data for that period appears for the main report.

My subreport contains the quantity of each item in the main report for each of these months (i.e. the first field is the quantity for March, the second is the quantity for April, the third is the quantity for May, etc.).

In the subreport, I need to create a formula that prints only the March quantities if the main report pulls for PERIOD 1, the April quantities if the main report pulls for PERIOD 2, the May quantities if the main report pulls for PERIOD 3, etc.

My purpose for wanting this is to have the subreport data only show data for the periods that the main report prints for. As it stands, currently, the subreport is showing data for each of the 12 monthly periods.

The subreport is in group footer #4, where it needs to stay.

Also, the subreport is a Crystal report that contains data from an Excel 2003 workbook. The main report pulls from a SQL database.

Thanks!


 
I think you could link on the {?Period} parameter. Create the same parameter in the subreport, and then link the subreport to the main report by using the dropdown in the lower left of the linking screen to select {?Period} instead of the default {?pm-?Period}. Then in the subreport->field explorer->formula->new, enter:

Select {?Period}
case 'Period1' : {table.Marchamt}
case 'Period2' : {table.Aprilamt}
//etc.

Not sure how you are currently selecting your subreport records or what other fields you have to work with--maybe post your subreport selection formula here.

Depending upon what you are grouping on, it might be necessary to also link on the higher order group fields, but you didn't specify the groups in the main report.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top