Skip to Content
0
May 09, 2018 at 09:09 PM

Report Optional prompt not working again.

155 Views

Several years ago in a previous version of Crystal Reports the optional prompt did not work properly and I had to set values to zero and test for that rather than using the HasValue function. I recently upgraded to v22 and now find all of my reports with parameters that support a list of values are now prompting the user for values, even when the list has values in it.

This routine has worked for several years and is used to set a list of values into parameters:

    Public Sub ApplyIDS()
        Dim pdv As ParameterDiscreteValue
        With _parameter.CurrentValues
            .Clear()
            Select Case _IDs.Count
                Case 0
                    If ZeroEmptyParameter Then
                        Report.SetParameterValue(_parameter.ParameterFieldName, 0)
                    Else
                        .IsNoValue = True
                    End If
                Case 1
                    If _parameter.ParameterType = CrystalDecisions.Shared.ParameterType.StoreProcedureParameter Then
                        Report.SetParameterValue(_parameter.ParameterFieldName, _IDs(0))
                    ElseIf _parameter.ParameterType = CrystalDecisions.Shared.ParameterType.ReportParameter Then
                        SetCrystalParam(Me.Report, _parameter.ParameterFieldName, _IDs(0))
                    End If
                Case Else
                    For Each paramValue As Int32 In _IDs
                        pdv = .AddValue(paramValue)
                    Next
            End Select
        End With
    End Sub

The Case Else is the one being executed. After this exits I can see that the parameter in question has a list of current values. The report in question uses the following code to check the parameter:

((({?MICID}=0) and hasvalue({?MICShareID}) and {vwMICSharesForRedemption.MSID}={?MICShareID})
or ({vwMICSharesForRedemption.MICID}={?MICID})
    and ({vwMICSharesForRedemption.TransferCertificateRequired} = true
         or {vwMICSharesForRedemption.RedemptionCertificateRequired} = true))

In this report the MICID is usually zero and a list of MICShareIDs is set by the above code. As of the most recent version, all of the reports which use this technique are now ignoring the list of values that have been set and are prompting for lists of values. What changed between v13 and v22?

I am a little desperate as I need to get a release out and I was going to upgrade all of the users to the most recent v22 runtime. I cannot do so if all of the reports are going to prompt for parameters.

Thanks, Neil