Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Operation illegal on linked parameter

Status
Not open for further replies.

Cyberyaga

Programmer
Jul 12, 2004
2
US
Hi...

I am using reports made in CR 8, and I am developing a web app in ASP.net using VB.net that looks at all reports in a specific directory and when you click on the report it checks for parameters and then displays the report with the CrystalReportViewer.

The problem is this:
One of the reports has 2 subreports. I need to know how to handle the parameters that are in those subreports. If I leave them out (not populate them) I get a "parameter missing" error. If I populate the 2 fields (one for each subreport) I get a "Operation illegal on linked parameter".

Please help, my code is posted below... any suggestions are helpfull

If crReportDocument.DataDefinition.ParameterFields.Count > 0 Then '======if report has Parameter Fields

For Each Param In crReportDocument.DataDefinition.ParameterFields

Select Case Param.ParameterValueKind

Case ParameterValueKind.BooleanParameter

Case ParameterValueKind.CurrencyParameter
Case ParameterValueKind.DateParameter
Case ParameterValueKind.DateTimeParameter
Case ParameterValueKind.NumberParameter
Case ParameterValueKind.StringParameter

Dim discvalue As New ParameterDiscreteValue
Dim currentValues As ParameterValues
Dim discreteParam As ParameterDiscreteValue


For Each discvalue In Param.CurrentValues
currentValues = Param.CurrentValues
discreteParam = New ParameterDiscreteValue
discreteParam.Value = "HDUS00000291600"
currentValues.Add(discreteParam)
Param.ApplyCurrentValues(currentValues)
Next

Case ParameterValueKind.TimeParameter

End Select

End If
Next
End If
 
I was having the exact same problem.

This was a result of my making an unnecessary call to myReport.Refresh() after I had set the parameter with a call to myMainReport.SetParameterValue ("MyParameterName", "MyParameterValue")

I removed the call to myMainReport.Refresh() and everything works as expected. I did confirm that you only need to set the parameter value in the main report which is then propogated to any subreports using the linked parameter. You should not have to directly set any values for linked subreport parameters

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top