cancel
Showing results for 
Search instead for 
Did you mean: 

CR SP26 VS2019 Parameter Panel Missing Parameters

kevin_hicks
Explorer

I have run the the update to SP26 for some reason my parameters are no longer showing up in the parameter panel on the web crystalreportviewer after the report has initially loaded. The parameter(s) is prompted initially to run the report.

As a work around I have set HasToggleParameterPanelButton= false, HasRefreshButton=true, and ReuseParameterValuesOnRefresh=false.

<CR:CrystalReportViewer ID="Report" Runat="server" AutoDataBind="true" Height="1250px" HasCrystalLogo="False" HasRefreshButton="True" HasToggleParameterPanelButton="false" BestFitPage="True" ReuseParameterValuesOnRefresh="false" ToolPanelView="None" DisplayStatusbar="True" HasToggleGroupTreeButton="false" EnableDatabaseLogonPrompt="False" PrintMode="ActiveX" />

This does show the parameter(s) as expected. My report parameters are set to editable and when you loop through the parameterfield using the code below the Usage2 values is already set to all the available values (side note, this snip came from another post, but if you try it you will get a Not Supported exception)

foreach (CrystalDecisions.Shared.ParameterField parameterField in reportDocument.ParameterFields)
{
  parameterField.ParameterFieldUsage2 = ParameterFieldUsage2.ShowOnPanel;
}

As you can see from pic here the parameter for this report is missing from the Parameter Panel. Not sure how to fix this issue. Any suggestions would be appreciated. Thinking it might be a bug. I included my code below for reference. Prior to SP25 I was clearing the parameterfieldinfo property using Report.ParameterFieldInfo.Clear() in the report init method. This might have something to do with the missing parameters, but I have no way of testing, because if I add that back I cannot get the report to load as when you click the OK on the parameter dialog the report's ajax postback just returns the parameter dialog back instead of the rendered report.

 Private crReportDoc As ReportDocument
 Private rpt As String

    Private Sub Report_Init(sender As Object, e As System.EventArgs) Handles Report.Init
        Dim exportFormatFlags As Integer = CInt(CrystalDecisions.[Shared].ViewerExportFormats.PdfFormat Or CrystalDecisions.[Shared].ViewerExportFormats.ExcelFormat)
        Report.AllowedExportFormats = exportFormatFlags
        'Report.ParameterFieldInfo.Clear() 'started causing prompt to not go away if set 'removed 12/13/19 CR SP25 & SP26
        LoadCRV()
    End Sub
    Sub LoadCRV()
        Try
            rpt = Request.QueryString("rpt")
            If rpt Is Nothing Then Response.Redirect("~/reports/crm.aspx")
            Dim rptPath As String = Nothing
            If rpt IsNot Nothing Then rptPath = Server.MapPath("~/reports/cr/" + rpt)
            If rptPath IsNot Nothing Then
                Try
                    crReportDoc = New ReportDocument
                    crReportDoc.Load(rptPath)
                    For Each rd As ReportDocument In crReportDoc.Subreports
                        crDBLogin(rd)
                    Next
                    crDBLogin(crReportDoc)
                    Report.ReportSource = crReportDoc

                    Report.RefreshReport()
                Catch ex As CrystalReportsException
                Catch ex As Exception
                End Try
            End If
        Catch ex As Exception
        End Try
    End Sub
    Private Sub cr_Unload(sender As Object, e As System.EventArgs) Handles Me.Unload
        If rpt IsNot Nothing Then
            If crReportDoc IsNot Nothing Then
                If crReportDoc.Subreports IsNot Nothing Then
                    For Each srDoc As ReportDocument In crReportDoc.Subreports
                        If srDoc IsNot Nothing Then
                            srDoc.Close()
                            'srDoc.Clone() 'idea from web post
                            srDoc.Dispose()
                            GC.Collect()
                            'GC.WaitForPendingFinalizers() 'idea from web post
                        End If
                    Next
                End If
                crReportDoc.Close()
                'crReportDoc.Clone() 'idea from web post
                crReportDoc.Dispose()
                GC.Collect()
                'GC.WaitForPendingFinalizers() 'idea from web post
            End If
            If Report IsNot Nothing Then
                Report.Dispose()
            End If
        End If
    End Sub

Notes about my upgrade:

I ran the exe as the admin as instructed. I let it install the 64bit msi. The 32bit msi was already installed, but did not get updated. I updated it manually. The VS toolbox still has the .3500 controls referenced so I removed them and added the new items (not sure if that was suppose to happen automatically). I did remove all my references in the image below and added them back which updated the project file to the .4000 dll's.

Project Specs
x86, 4.7.2 framework

kevin_hicks
Explorer
0 Kudos

So I have made some progress. I have updated my viewer to the following:

<CR:CrystalReportViewer 
           ID="crReportViewer" Runat="server" AutoDataBind="True" Height="1250px" HasCrystalLogo="False" BestFitPage="True" DisplayStatusbar="True" ToolPanelView="None" PrintMode="ActiveX"
           EnableDatabaseLogonPrompt="False" 
           ReuseParameterValuesOnRefresh="True" 
           HasRefreshButton="True" 
           HasToggleParameterPanelButton="True"
           HasToggleGroupTreeButton="True" 
           /> 

Now the parameters are showing in the parameter panel and the report is loading correctly after the original parameter prompt closes. However, now whenever there is a postback on reports that includes optional prompts in the report, the parameter prompt is shown again with just those optional parameters. He is an example of the flow.

1. Load report in web viewer that include 4 parameters, 2 of which are optional
2. Built-in viewer parameter dialog shows and only the required parameters are picked and click OK
3. Report loads in viewer correctly.
4. Any postback is fired from viewer (this example let's say you click Next Page button)
5. Built-in viewer parameter prompt appears with only the 2 optional parameters
6. You just click OK and the prompt closes, but you are still on page 1.
7. You click Next Page again, but this time when the 2 optional parameters appear you select values for both and click OK. 8. Report not loads with values set for all 4 parameters.
9. You not click Next Page again, but this time you are shown page 2 as expected.

So it appears to me something is up with the optional parameters after the initial loading of the report. Here is my code that handles my report loading. I cannot figure out what I am doing wrong. Like I said before this all worked prior to SP25. Something has changed and I am not sure what I need to do now for the optional parameters not to appear after the report is loaded unless I pick the parameter from parameter panel.

  Private crReportDoc As ReportDocument
    Private rpt As String

    Sub LoadCRV()
        Try
            rpt = Request.QueryString("rpt")
            If rpt Is Nothing Then Response.Redirect("~/reports/crm.aspx", False)
            Dim rptPath As String = Nothing
            If rpt IsNot Nothing Then rptPath = Server.MapPath("~/reports/cr/" + rpt)
            If rptPath IsNot Nothing Then
                Try
                    crReportDoc = New ReportDocument
                    crReportDoc.Load(rptPath)

                    For Each rd As ReportDocument In crReportDoc.Subreports
                        crDBLogin(rd)
                    Next
                    crDBLogin(crReportDoc)

                    crReportViewer.ReportSource = crReportDoc

                    'crReportViewer.RefreshReport()
                Catch ex As CrystalReportsException

                Catch ex As Exception

                End Try
            End If
        Catch ex As Exception

        End Try
    End Sub

    Private Sub crReportViewer_Init(sender As Object, e As EventArgs) Handles crReportViewer.Init
        Dim exportFormatFlags As Integer = CInt(CrystalDecisions.[Shared].ViewerExportFormats.PdfFormat Or CrystalDecisions.[Shared].ViewerExportFormats.ExcelFormat)
        crReportViewer.AllowedExportFormats = exportFormatFlags
        'crReportViewer.EnableParameterPrompt = False
        'Report.ParameterFieldInfo.Clear() 'started causing prompt to not go away if set 'removed 12/13/19 CR SP25 & SP26
        LoadCRV()
    End Sub

    Sub crDBLogin(ByVal rptDoc As CrystalDecisions.CrystalReports.Engine.ReportDocument)
        Try
            Dim crCI As New CrystalDecisions.Shared.ConnectionInfo
            With crCI
                .ServerName = System.Configuration.ConfigurationManager.AppSettings("sqlserver")
                .DatabaseName = System.Configuration.ConfigurationManager.AppSettings("database")
                .UserID = System.Configuration.ConfigurationManager.AppSettings("user")
                .Password = System.Configuration.ConfigurationManager.AppSettings("pwd")
                .Type = CrystalDecisions.Shared.ConnectionInfoType.SQL
                .IntegratedSecurity = False
            End With
            For Each crTable As CrystalDecisions.CrystalReports.Engine.Table In rptDoc.Database.Tables
                Dim li As CrystalDecisions.Shared.TableLogOnInfo = crTable.LogOnInfo
                li.ConnectionInfo = crCI
                crTable.ApplyLogOnInfo(li)
                'crTable.Location = crCI.DatabaseName & ".dbo." & crTable.Location.Substring(crTable.Location.LastIndexOf(".") + 1)
            Next
            'rptDoc.SetDatabaseLogon(ConfigurationManager.AppSettings("user"), ConfigurationManager.AppSettings("pwd"), ConfigurationManager.AppSettings("sqlserver"), ConfigurationManager.AppSettings("database"))
            rptDoc.VerifyDatabase()
        Catch ex As CrystalDecisions.Shared.CrystalReportsException


        End Try
    End Sub

    Private Sub cr_Unload(sender As Object, e As System.EventArgs) Handles Me.Unload
        If rpt IsNot Nothing Then
            If crReportDoc IsNot Nothing Then
                If crReportDoc.Subreports IsNot Nothing Then
                    For Each srDoc As ReportDocument In crReportDoc.Subreports
                        If srDoc IsNot Nothing Then
                            srDoc.Close()
                            'srDoc.Clone() 'idea from web post
                            srDoc.Dispose()
                            GC.Collect()
                            'GC.WaitForPendingFinalizers() 'idea from web post
                        End If
                    Next
                End If
                crReportDoc.Close()
                'crReportDoc.Clone() 'idea from web post
                crReportDoc.Dispose()
                GC.Collect()
                'GC.WaitForPendingFinalizers() 'idea from web post
            End If

            If crReportViewer IsNot Nothing Then
                crReportViewer.Dispose()
            End If
        End If
    End Sub
kevin_hicks
Explorer
0 Kudos

And just to be clear. I can load this very same report is optional parameters in CR 2013 SP12 and after the initial parameter selection I go directly to page two without getting prompted for the optional parameter. So this would make me believe nothing is wrong with the actual report itself.

former_member752739
Discoverer
0 Kudos

Is there any resolution to this issue? I am having the same problem with my reports. Parameter panel is missing parameters.

Former Member
0 Kudos

I saw your posted comment. Please raise a new question and follow our rules of engagement: https://community.sap.com/resources/rules-of-engagement. I suggest using the "I have a similar question" option under the question to get started. Feel free to take our Q&A tutorial at: https://developers.sap.com/tutorials/community-qa.html. With these tips you'll be able to prepare questions that draw responses from our members.

Best,

Your SAP Community moderator

View Entire Topic
0 Kudos

Here's the KBA and Incident numbers:

2889303 - Crystal Reports for Visual Studio SP 26 - Next Page causes Optional Parameter to prompt for value

Incident 89393 / 2020 / Paging causes Optional Parameter to prompt each time

Expected to be released in SP 27 due out in April, maybe... no date set at this time.