Passing Parameters to a Crystal Report with a Subreport
- From: cdmunoz <cdmunoz@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 12 Feb 2008 09:42:03 -0800
I've created a report that summarizes a client's record, but then has a
subreport attached that gives historical information.
Okay, here's the issue. I can call this report and pass it the parameters
needed through my .NET program and it works great if only 1 client is
selected. However, if multiple clients are selected then the subreport will
list every historical record for every client selected on each client's
summary report.
On the report: under the subreport links - I have the checkbox "Select data
in subreport based on field" checked. In the subreport - the parameter field
is set to allow "Multiple values" and "Discrete values".
In the program - I'm loading an array with each parameter value that's
selected from the main report (each client's id) and then I'm setting the
report's parameter value to that array.
Here's a snippet of the code:
For Each lRow As DataRow In DataSet.Rows 'Main report's dataset
Dim lpdvValue As ParameterDiscreteValue = New ParameterDiscreteValue
lpdvValue.Value = lRow("ID").ToString
CurrentParameterValues.Add(lpdvValue)
ParameterArray.Add(lpdvValue)
Next
'*** then after loading the main report...
If SubReportFlag Then 'Denotes whether a subreport is attached to the
report.
Dim lpfdDefinitions As ParameterFieldDefinitions =
objectReport.DataDefinition.ParameterFields
Dim lpfdDefinition As ParameterFieldDefinition =
lpfdDefinitions(ParameterName)
lpfdDefinition.ApplyCurrentValues(CurrentParameterValues)
objectReport.OpenSubreport(SubReportName).SetDataSource(subreportdataset)
objectReport.SetParameterValue(ParameterName,
ParameterArray.ToArray(), SubReportName)
End If
As stated previously, it works fine if the user selects 1 client, but not
with multiple clients....what am I missing?
--
Cindy
.
- Follow-Ups:
- Re: Passing Parameters to a Crystal Report with a Subreport
- From: marklar20
- Re: Passing Parameters to a Crystal Report with a Subreport
- Prev by Date: accordion control css lost
- Next by Date: Re: Any way to call a method of a class by name?
- Previous by thread: accordion control css lost
- Next by thread: Re: Passing Parameters to a Crystal Report with a Subreport
- Index(es):
Relevant Pages
|