C
cdmunoz
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?
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?