Symptom
Error in File {23BBD53D-46B0-4749-90DS-C3DDE2240141}.rpt: Invalid parameter name.
Stack trace:
" at
CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e) at
CrystalDecisions.ReportSource.EromReportSourceBase.HandleException
(Exception exception) at
CrystalDecisions.ReportSource.EromReportSourceBase.GetReportInfo
(RequestContext reqContext) at
CrystalDecisions.Web.ReportAgent.ReportClosedExceptionHandlingReportSource.GetReportInfo(RequestContext reqContext) at
CrystalDecisions.Web.ReportAgentBase.GetReportInfo() at
CrystalDecisions.Web.ReportAgentBase.get_IsLogOnInfoUsingIntegratedSecurity() at CrystalDecisions.Web.ReportAgentBase.FillReportState
(RequestContext request) at
CrystalDecisions.Web.ReportAgent.GetPage
(Boolean bSeparatePages) at
CrystalDecisions.Web.CrystalReportViewer.GetPage() at
CrystalDecisions.Web.CrystalReportViewer.OnPreRender(EventArgs e)"
Cause
The parameter field exists in the report, but is not used in the report, and values are being set to this parameterfield at runtime.
Resolution
- In the Report Application Server (RAS) sdk, parameterfields have a Usage property that can be used to determine various usage options of the parameterfield.
- The integer value returned by ParameterField.Usage is a summation of the usage enum values derived from CrParameterFieldUsageEnum.
- The following Usage enumerators and thier integer values are available:
CrParameterFieldUsageEnum.crParameterFieldUsageCurrentValuesProvidedByServer = 4
CrParameterFieldUsageEnum.crParameterFieldUsageDataFetching = 32
CrParameterFieldUsageEnum.crParameterFieldUsageEditableOnPanel = 16
CrParameterFieldUsageEnum.crParameterFieldUsageUsageInUse = 1
CrParameterFieldUsageEnum.crParameterFieldUsageIsLinked = 64
CrParameterFieldUsageEnum.crParameterFieldUsageNotInUse = 2
CrParameterFieldUsageEnum.crParameterFieldUsageShownOnPanel = 8
CrParameterFieldUsageEnum.crParameterFieldUsageUnKnown = 0
- To determine if one of these enumerations is used by a parameterfield, perform a bitwise AND operation on the enumerator and the value returned by the ParameterField.Usage property. If the result of the bitwise AND is non-zero, then that particular enumerator is 'Used' and set in the parameterfield.
- For example, if a parameter field was created in the designer with the following value option:
Show on (Viewer) Panel = Editable
then it would contain the following enums:
CrParameterFieldUsageEnum.crParameterFieldUsageEditableOnPanel = 16
CrParameterFieldUsageEnum.crParameterFieldUsageShowOnPanel = 8
If the parameter field is not used in the report, then it would also have the following enum:
CrParameterFieldUsageEnum.crParameterFieldUsageNotInUse = 2
- The summation of these enums (16 + 8 + 2 = 26) would be the integer value returned by ParameterField.Usage.
- Using the above example, we can use the SDK to determine if the parameter field is used in the report.
26 AND 2 = 2
or looking at the bit mask:
11011 (26)
AND 00010 (2)
00010 (2) <-- result is crParameterFieldUsageNotInUse is true.
- The following code demonstrates how to determine if a parameterfield is used in a report:
VB:
If (paramField.Usage And Convert.ToInt16(CrParameterFieldUsageEnum.crParameterFieldUsageNotInUse)) <> 0 Then
'Field is not used on the report
Else
'Field is used on the report since the AND operation returned zero
End If
C#:
if(((int)pfld.Usage & (int)CrParameterFieldUsageEnum.crParameterFieldUsageNotInUse) != 0)
{
//Field is not used on the report
}
else
{
//Field is used on the report since the AND operation returned zero
}
Keywords
invalid parameter name; SDK, RAS, .NET, 2008, crystal reports, parameterfield, InUse, , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To