cancel
Showing results for 
Search instead for 
Did you mean: 

Sub Report and Grouping in CR XI

Former Member
0 Kudos

Post Author: rickcf

CA Forum: General

I am new to CR XI so hopefully this is an easy question.

I have a report that has several selection criteria and then picks a batch of records from tableA and groups them by the tableA.number which is not unique u2013 thus the grouping. There is no detail in this report just printing out via the group. TableA is connected to tableB vi foreign and primary key and the relationship is 1 TableA to many TableB. I want the child records to print at the very end of the report so I created a subreport for tableB (with its own set of supporting tables), linked it with the FK & PK link and put it in the report footer. (This works if you have no grouping.)

My problem is the sub report only prints the data pertaining to the last grouping of records and not for all records. Is there any way to get the sub report print with all records instead of just the last group printed?

Open to any suggestions.

Thanks

Rick

Accepted Solutions (0)

Answers (9)

Answers (9)

Former Member
0 Kudos

Post Author: rickcf

CA Forum: General

Got it! I finally noticed and was not aware that the subreport parameters only shows in the 'Subreport Parameter Field To Use' dropdown combo and only if you scroll down. After figuring that out I got a bunch of sub report records printing now.

Thanks!

Former Member
0 Kudos

Post Author: wapper

CA Forum: General

When I spoke about applying same selection formula to your subreport, I meant that it can be done via frontend application. You can change the selection formula for main report, or subreports, or both from the application, by using RDC for example.

Wapper

Former Member
0 Kudos

Post Author: wapper

CA Forum: General

Passing parameters is easy - just create new parameters in the subreport and use Subreport Link screen to bind the parameters of main report to corresponding parameters in subreport. Then open Selection Formula in subreport and use parameter values to limit the result of the subreport query.

By doing so, you will avoid being asked to provide parameter values again for the subreport.

Wapper

Former Member
0 Kudos

Post Author: rickcf

CA Forum: General

TableA is included in the subreport so that is not a problem. Still not sure what is exactly meant by passing the parameter values to subreport. I do not know what that means or entails. If the only way to 'pass parameters' is using the Change Subreport Links screen and making the links then I am not sure this will work. If it means taking control and making varaibles to pass data and using the variables in some sort of SQL statement that is used in the child then it should be able to work. If possible I don't know how to achieve this - yet.

Rick

Former Member
0 Kudos

Post Author: Charliy

CA Forum: General

Sounds like you need to include Table A in the subreport for the purpose of doing the selection. Then pass the data parameters as links and use them in the select in your subreport.

Former Member
0 Kudos

Post Author: rickcf

CA Forum: General

I might also add that two of the parameters of the Parent report TableA is a begining and ending date range on one of the tableA date fields. Not sure how to make the {TableA.ARCHIVE_DATE} in {?ArchStartDate} to {?ArchEndDate} work with passing parameters.

Rick

Former Member
0 Kudos

Post Author: Charliy

CA Forum: General

Where in the main report is the subreport? If it's in the Report Footer, it's only getting passed the last record from the main report.

Former Member
0 Kudos

Post Author: rickcf

CA Forum: General

The two are linked with a primary (tableA) key and the foreign key in the child tableB (the tableA key) so yes, they are linked togeather. Right now they are using the subreport links to link these togeather. What you are describing is what I am seeing and good to know.

I think the passing the parameters to the sub report will work. I have not learned how to do that yet so I am guessing here. Do I create the same parameters in the sub report? Or do I just use the selection expert with the same formula as the parent report only using the passed in variables? I need some direction here.

You also mentioned that I could just apply the same selection formula to main report and the subreport but then my question is how do you suppress it from asking the user twice for the same selection criteria on the selection screen? I actually did something simular to this early on and it asked the user for the selection criteria twice on the same screen - once for the main report and once for the subreport. It does sound easier just to pass the parameters though.

Thanks for the suggestion and help.

Rick

Former Member
0 Kudos

Post Author: wapper

CA Forum: General

How do you actually link your subreport? By which fields? When subreport is placed in the report footer, it will only display data for the last data row of the main report (providing that subreport is actually linked to the data in main report). So you cannot link you subreport to all data rows of main report. If you need to propagate the selection criteria from main report to subreport, you might try to use parameters in main report and pass the parameter values to subreport. Or you could just apply the same selection formula to main report and the subreport.

Wapper