Print Page | Close Window

Record Selection Formula

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=6929
Printed Date: 03 May 2024 at 1:53pm


Topic: Record Selection Formula
Posted By: scathenc
Subject: Record Selection Formula
Date Posted: 01 Jul 2009 at 10:39pm

Hi,

I have made a report whereby two tables are connected via their primary key. I wanted to show records where the primary key was equal to 6000030 for example.

I went into the record selection formula area and entered: {transaction.t_id} = '6000030'.

When I preview the report, it works perfectly, however if I load the exact same report through .Net (c#), it's as though the report ignores the selection formula and just goes ahead and shows all records.

I have tried entering the selection formula in the selection formula area, by linking it to a formula field, and also be entering it in code manually (dt.DataDefinition.RecordSelectionFormula = "{transactionlist.t_id} = '6000030'";. None of these are working and the report still shows all records.

I have made sure saving of data is turned off also. Does anyone have any ideas why this would be happening? (this is about my 50th report for this project, but the first where I have tried to use record selection. I use group selection in others and that works fine). Is this a bug in crystal??

C





Replies:
Posted By: lockwelle
Date Posted: 02 Jul 2009 at 6:23am
I am assuming that you stopped the c# app and then restarted it?  if this is an embedded report, it will need to be recompiled, even if it is loaded dynamically, I might still be leary.  I am also assuming that you saved the report...silly things, but I have goofed on them before.
 
No, record selection formula (Report/Selection Formulas/Records) works in reports.  I haven't used it in a while (I have the app call a stored proc and then I set the report datasource to this dataset, so the report only sees valid records to begin with), but I have never used the group selection (I was told not to by the person who trained me...he had worked for Seagate as CR tech support), so I doubt that it is that.
 
It is probably something else....just don't know at this time.
 
I am also assuming that you are joining directly to the tables in the report, otherwise, you wouldn't need to filter.
 


Posted By: scathenc
Date Posted: 05 Jul 2009 at 6:44pm

I rebuilt the app several times, and changed other things in the report to make sure it was running with the correct version. The only thing I can pin it down to, is that when c# loads the report, it is ignoring the recordselectionformula.

Any ideas?


Posted By: scathenc
Date Posted: 05 Jul 2009 at 11:22pm

I have tried debugging my code, by logging all database calls that the report manager is trying to make when loading the report. It is just as I expected, the report is ignoring whatever I have put for the recordselectionformula.

Any ideas why loading the report through c# is ignoring the recordselectionformula, but previewing the report in crystal is not?



Print Page | Close Window