Skip to Content

RecordSelectionFormula not applied a second time

Hi,

I'm using CR for VS SP 21 (inProc RAS - VB.Net 2015).

Let's take this sample:

  • I open a report (CrystalReports.Engine.ReportDocument.Load)
  • then setting the RecordSelectioFormula (using (CrystalReports.Engine.ReportDocument.RecordSelectionFormula)
  • exporting the report (f.ex. to PDF)
  • (everything's fine here)
  • now setting RecordSelectioFormula to a different filter
  • an export the report a second time
  • the second filter will not be applied!

PS. the report will not be closed and reopened for the 2nd export.

Any ideas,

Patrick

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

8 Answers

  • Best Answer
    Feb 01 at 01:01 PM

    I tried it again and yes, the Refresh() method did the trick.

    Thanks Don,

    Patrick

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 18, 2017 at 07:44 AM

    @Don,Ludek: any ideas?

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 03 at 07:24 AM

    Thanks for your reply.

    I was writing about exports, not about preview. So there's no Refresh or what do you mean?

    Patrick

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 02 at 02:23 PM

    Happy New Year Patrick,

    Did you call Refresh() on the second preview?

    Just got back from 2 weeks off so I'll try to confirm this soon.

    Thanks

    Don

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 11 at 03:49 PM

    Hi Patrick,

    Works for me, I open the report and preview it, I then have a button that sets a new record selection formula. I hit the button and the view the report, DO NOT use Refresh, it will resset the value you just set to the original. And I see the changes.

    Original report has this:

    {Customer.Customer Credit ID} <= 10

    In code I set it to this:

    rpt.RecordSelectionFormula = "{Customer.Customer Credit ID} >= 10";

    After update below:

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 18 at 07:47 AM

    Hi Don,

    Would it be possible to get the latest version of your test-program?

    Thanks,

    Patrick

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 23 at 07:41 AM

    Reminder.... for the test program...

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 25 at 04:12 PM

    OK, this is odd, I missed my own view test....

    My first test it DID NOT work fine when viewing the report.

    The Data only shows 1 row with 10 and not >10.

    I had to call rpt.Refresh(); after the record selection change.

    Other odd part is Exporting automatically reruns the reports so I need to test when exporting as well...

    Update you soon...

    Same for exporting, refresh must be called.

    Don

    Add comment
    10|10000 characters needed characters exceeded