问题
Background
I have a Crystal Report.
For multiple items entered into a parameter (which I believe becomes a string array), I would like it to group by those values and then run a number of sub-reports for each group item.
Goal
For items entered as part of a parameter (which allows multiple items), use those items as a group so that I can see multiple sub-reports for those items (including if no data can be found for a given item).
To clarify, the desired process is:
- User runs the report
- User is prompted to enter one or more item numbers into the ItemNumbers parameter
- The ItemNumbers parameter is used to create groupings
- The groupings run several sub-reports for each group (presumably in the group footer)
- The users see the results (or non-results) for each of the subreports under each item group.
Roadblocks / attempts so far
- Tried to use the parameter as the grouping. This isn't possible as it does not show up in the list of things I can select for a grouping.
- Tried to use a formula to hold the value of the parameter. This is not possible because formulas cannot result in an array.
- Tried to create a StringArray variable to hold the parameter entries, but since it also must be referenced in a selection formula and formulas can't be arrays, this failed.
回答1:
You can't group on a parameter field. You will need to use it to filter your recordset, then group on one of its (recordset's) fields.
** edit **
I would create a number of queries that compare the individual transaction tables to the 'main' table (LEFT OUTER JOIN), then UNION these queries. Create a report, using this query as the source of a Command object.
来源:https://stackoverflow.com/questions/11658321/crystal-report-how-can-i-use-a-list-of-parameter-items-as-a-group