Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question for Record Selection Formula

Status
Not open for further replies.

Thanhly

Programmer
Jul 8, 2004
9
CA
Hi,

In the report, I have 2 parameters:

1. DateRange, data type is date, User can pick the date range.
2. Permit_Status, data type is String, User can select only one as follow: (Default to "Approved")
- Approved
- Issued
- Pending

In the Record selection formula, I have the following codes:

If {?Permit_Status} = "Approved" Then
{DB.Approved_Date} In {?DateRange}
Else If {?Permit_Status} = "Issued" Then
{DB.Issued_Date} In {?DateRange}
Else If {?Permit_Status} = "Pending" Then
{DB.Pending_Date} In {?DateRange}



The Report does not pick up these condition, is any Expert know why?

Thanks
 
The code seems OK, check what's in {?Permit_Status} by placing it on the report, and then you might also place this formula on the report to test as well:

Also check the Database->Show SQL Query to see what is being passed.

-k
 
- Yes, I did check it by puting the parameter on the report, and the string come out as what I pick. Example if I pick Issued as the paramter then it will display the string "Issued" and so on

But in the Database->show SQL is NOT passing the condition.

Thanks
 
Hi,
Try using only 1 parameter at a time and displaying the field(s) referenced by the other one(s) to see the valid values.
Also,
using Crystal's Range type parameter values may prevent the selection criteria from being passed to the Database ( depends on the database and the connection type) I usually use 2 Date parameters (StartDt and EndDt) - These are almost always passed as part of the where clause to the database..
( {table.dateField} >= {?StartDt} and {table.dateField} <= {?EndDt} )





[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Yes, I did try the following combination,
1. DateRange for the Approved_Date,
2. DateRange for the Issued_Date,
3. DateRange for the Pending date.

it all working and the result is expected. But only the problem is when I place the IF condition in, Database->Show SQL Query does not display the date range condition.

Thanks,
 
Not sure this will help, but you might try:

(
{?Permit_Status} = "Approved" and
{DB.Approved_Date} = {?DateRange}
) or
(
{?Permit_Status} = "Issued" and
{DB.Issued_Date} = {?DateRange}
) or
(
{?Permit_Status} = "Pending" and
{DB.Pending_Date} = {?DateRange}
)

-LB
 
Ahhh, OK, you posted "The Report does not pick up these condition, is any Expert know why?" when I guess that you meant that it isn't being passed to the database.

LBs solution should work, if not state your database type, connectivity and version of Crystal, which should be included with any post.

You can check out my FAQ as well:

faq767-3825

-k
 
Thanks for all the input. I try lBass suggestion and it work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top