cancel
Showing results for 
Search instead for 
Did you mean: 

Generate one report for each record in a table?

Former Member
0 Kudos

Post Author: calvin

CA Forum: General

I'm not sure how to even get started with this task. I have an application where the user wants several reports generated (actually this is one report generated several times with different criteria) from criteria that is entered into a 'request' table. For example, the table contains:ReqDate, CriteriaType, GroupIDs, CriteriaValue where CriteriaType can be ALL, LE, or GE and CriteriaValue is a date, used when the CriteriaType is LE or GE. The GroupIDs can be one or more group ID's in a CSV list, e.g. G1,G2,G3. Typically the user will enter the same GroupIDs but request reports with differing Criteria Types. For example (columns separated by hyphens to distinguish from CSV list in GroupIDs column):Record 1: 04/20/2007-LE-G1,G3-04/30/2007Record 2: 04/20/2007-GE-G1,G3-05/01/2007The user wants the report run twice, both selecting records (from another table) in Groups G1 or G3, once with CriteriaDate <= 04/30/2007 and the second time with CriteriaDate >= 05/01/2007.I have no problem creating the report & I can even set it up to select the criteria from the request table. The problem is running it once for each record (with the request date, which is entered as a parameter), using the criteria from that record.I think I need to use a subreport but I've never used them for anything so I'm not sure how to even get started.Thanks for any suggestions.

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Post Author: V361

CA Forum: General

I made the "assumption" you only had one details area. If you have detail a, and a subreport in detail b, you should get a subreport, with each of the detail a's

Former Member
0 Kudos

Post Author: calvin

CA Forum: General

Yes, after I posted the question I went looking & found how to save the subreport. Thanks.I'm not sure what moving the subreport from Details a to Details b would accomplish-or am I misunderstanding what you're recommending?Is there a workaround for the Page header issue? I think everything in the page header comes from the request record so maybe I could try moving it to the main report.Thanks.

Former Member
0 Kudos

Post Author: V361

CA Forum: General

You can insert a section in your details (detail b) see if you can drop the subreport there. Yes, it is kind of normal to have the page header issue with sub reports. You should be able to save the subreport out...

Former Member
0 Kudos

Post Author: calvin

CA Forum: General

This comes sooooo close. What I need is for the subreport to be generated for each record in the request table. The subreport should then use the data in the request record to select the records in the other table to report.My main report is, essentially, blank except for the subreport in the Detail section. The main report does select the request records and it does generate a subreport for each request record. The problem is that both of the subreports produced (I'm testing with only 2 request records) contain identical data-but the request records, which control the selection of the records that are reported, are different.Also, for some reason my subreport doesn't have a Page Header section-is that normal? How can I insert one?Is there a way to save the subreport separately? It would be convenient, for testing, if I could run the subreport 'stand-alone', passing in the criteria normally supplied by the main report, i.e. a specific request record.Thanks.

Former Member
0 Kudos

Post Author: calvin

CA Forum: General

Thanks. I still have quite a bit to do before I'm sure this will work, but my initial test says it will. I appreciate your help-I was going around in circles trying to figure out how to get started on this.

Former Member
0 Kudos

Post Author: V361

CA Forum: General

Try taking a copy of the existing report (just in case), in it, click on the subreport option, and create from file, select the original report. Put the sub report in one of your group footers, or page footer for now. If you run the new report, you should end up with your original report, followed by a copy of the original. You can then modify the subreport to create the output you are looking for. ( you may get promted multiple times for any select criteria ) , you can fix this by creating a link to the subreport. Hope this helps.