cancel
Showing results for 
Search instead for 
Did you mean: 

Report Selection Formula Problem

0 Kudos

Hi,

( I am using Visual Studio 2013, a report developed in CR Developer 11.5.12.1838,VB.Net and am developing an .aspx web page )

Say I have a selection formula e.g.

Dim myReportSelectionFormula = "{INVOICE.INV_NO} = 'h3076648'"

CrystalReportViewer1.SelectionFormula = myReportSelectionFormula

I can view this invoice number well.

I then change the criteria to a different invoice

Dim myReportSelectionFormula = "{INVOICE.INV_NO} = 'h3543461'"

CrystalReportViewer1.SelectionFormula = myReportSelectionFormula

and not the report will not display the changed invoice number ( only blank fields etc ).

I can then change the invoice number back to the original number and it works again.

The report ( .rpt file)  does not have the data saved in it.

I would like to know if I am doing something incorrectly? Do I need to "reset" the report some how, to stop it from being cached etc?

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Hi Scott

Not sure if you are using "SAP Crystal Reports, Developer Version for Visual Studio .NET", but you will have to with VS 2013.

Next, I am not sure what the code looks like, but if you want to set the selection formula again, you will have to unload the report and re- initialize it.

E.g.;

load report

set selection formula

view

close report

Dispose report

load report

set new selection formula

view

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow me on Twitter

0 Kudos

Hi Ludek,

Thanks for your reply.

yes, I use use "SAP Crystal Reports, Developer Version for Visual Studio .NET"

I have added:

    Protected Sub Page_Unload(sender As Object, e As EventArgs) Handles Me.Unload

        CrystalReportViewer1.Dispose()

    End Sub

I couldn't find a Close() method for the viewer though.

The report does now swap invoice numbers okay in the selection formula.

To be honest though, I had a thought during the night, I may have also been using an invoice number that doesn't generally get displayed on the report I was using ( different table structure ) that may have also been a cause of it not displaying any data.

Thanks again

Answers (0)