Crystal Report linked subreport parameter not working properly

crystal-reportsreport

I have a main report with one group, part_id, that contains a subreport in the group header. There are two linked parameters in the subreport. One is part_id, same as the group in the main, and the other is stores_code. The part_id parameter is working properly, but the stores_code parameter is not. If a stores_code is chosen, then it works, but if no stores_code is chosen, then the subreport only returns one record. I was expecting that it would return all stores_code for that part_id. Is this because the subreport is in the group header? If I remove the link to *stores_code*, then all of the records show up in the subreport, but then I have the opposite problem. If the user chooses a specific stores_code, the subreport still shows all records.

My research led me to believe I need to change the settings of my parameter to allow multiple and/or to make it optional and/or give it a default and/or allow null values for the parameter. However, I am using parameters automatically created by Crystal when the subreport links are added. When you right-click on these parameters the edit option is not available. So I figure I need to make my own parameters, change the settings, and link to them instead. However, when I create my own parameters and link to them, the select data based on subreport field option is not available.

To make this even more unlcear, these report are run from a third party application. The selection of part_id and stores_code is made inside this application. It is kind of a black-box in that I don't actually have part_id and stores_code parameters in the main report. The application takes care of the selection, but I don't know exactly how.

Best Answer

If you're displaying the subreport in the 'part_id' group header, the only field you can count on being reliably available is 'part_id'. If there are multiple 'stores_code's in each group, only the first record's 'stores_code' of the group will be passed to the subreport. This goes for all other data in the record, also.

If you want to filter the entire report based on certain 'stores_code's via user parameter then you'll need to pass the main report's parameter values to the subreport and do the filtering there.

Related Topic