Skip to Content
0
Former Member
Sep 10, 2008 at 09:51 PM

Crystal Reports .NET 2005 Subreport linked with parameters and command cols

45 Views

Sorry if this has been asked before, but I cannot find the answer after looking for over an hour.

I have a Crystal XI report that I am using in .NET 2005 that links on a paramter (same parameter name in the main and sub report), AND links on 2 command object columns.

The links looks like this:

[http://i389.photobucket.com/albums/oo332/bowlegtroy/SubReportLinks.jpg|http://i389.photobucket.com/albums/oo332/bowlegtroy/SubReportLinks.jpg]

I'm trying to pass the parameters to the main report via code in ASP.NET (C#) like so:

private void SetCurrentValuesForParameterField(ReportDocument rptDoc, string szParameter, ArrayList valuesARY)

{

ParameterValues currParamValues = new ParameterValues();

foreach (object singleValue in valuesARY)

{

ParameterDiscreteValue paramDiscVal = new ParameterDiscreteValue();

paramDiscVal.Value = singleValue.ToString();

currParamValues.Add(paramDiscVal);

}

ParameterFieldDefinitions paramFldDefs = rptDoc.DataDefinition.ParameterFields;

ParameterFieldDefinition singleParamFldDef = paramFldDefs[szParameter];

singleParamFldDef.ApplyCurrentValues(currParamValues);

}

This works for other reports that do NOT have sub reports. However, thsi si the first sub report we are trying to set up and cannot get it to work properly.

Error it throws is this one:

[http://i389.photobucket.com/albums/oo332/bowlegtroy/SubReportLinks_Error.jpg|http://i389.photobucket.com/albums/oo332/bowlegtroy/SubReportLinks_Error.jpg]

Why does this fail? Is there a workaround or fix?