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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parentheses in the Select Expert

Status
Not open for further replies.

WestView

Technical User
Jan 7, 2003
67
US

I think I’m screwing up the parentheses in the Select Expert because it ignoring other sets of parameters.

I have this set that returns the data I want:

(
If {?ParameterField} = "ParameterString1" Then {Db.Field} = "FieldString1" Else true) Or
(
If {?ParameterField} = "ParameterString2" Then {Db.Field} = "FieldString2" Else true ) Or
(
If {?ParameterField} = "ParameterString3" Then {Db.Field} = "FieldString3" Else true ) Or
(
If {?ParameterField} = "ParameterString4" Then {Db.Field} = "FieldString4" Else true ) Or
(
If {?ParameterField} = "ParameterString5" Then {Db.Field} = "FieldString5" Else true
)

However, when I add a couple of date parameters the report:

And {vCASH_RECEIPTS.PAY_DATE} = {?BeginDate}
And {vCASH_RECEIPTS.PAY_DATE} = {?EndDate}

It ignores them.

What am I doing WRONG!!!

Will appreciate any/all replys.

Thanks!

- Tom
 
Try:

(
{vCASH_RECEIPTS.PAY_DATE} >= {?BeginDate}
And
{vCASH_RECEIPTS.PAY_DATE} <= {?EndDate}
)
and
(
If {?ParameterField} = "ParameterString1" Then
{Db.Field} = "FieldString1"
else
If {?ParameterField} = "ParameterString2" Then
{Db.Field} = "FieldString2"
else
If {?ParameterField} = "ParameterString3" Then
{Db.Field} = "FieldString3"
else
If {?ParameterField} = "ParameterString4" Then
{Db.Field} = "FieldString4"
else
If {?ParameterField} = "ParameterString5" Then
{Db.Field} = "FieldString5"
)

-k
 
Hi K.,

Thank you for your reply!

I tried your suggestion. Unfortunately, the report then returned no data. In fact, it actually changed the syntax when I ran it to:

{vCASH_RECEIPTS.PAY_DATE} = {?BeginDate} and
{vCASH_RECEIPTS.PAY_DATE} = {?EndDate} and
(
If {?ParameterField} = "ParameterString1" Then
{Db.Field} = "FieldString1"
else
If {?ParameterField} = "ParameterString2" Then
{Db.Field} = "FieldString2"
else
If {?ParameterField} = "ParameterString3" Then
{Db.Field} = "FieldString3"
else
If {?ParameterField} = "ParameterString4" Then
{Db.Field} = "FieldString4"
else
If {?ParameterField} = "ParameterString5" Then
{Db.Field} = "FieldString5"
)


What's up with That?

Thanks again!

- Tom
 
Change

{vCASH_RECEIPTS.PAY_DATE} = {?BeginDate} and
{vCASH_RECEIPTS.PAY_DATE} = {?EndDate} and

to

{vCASH_RECEIPTS.PAY_DATE} in [{?BeginDate} to {?EndDate}] and

or

{vCASH_RECEIPTS.PAY_DATE} >= {?BeginDate} and
{vCASH_RECEIPTS.PAY_DATE} <= {?EndDate} and
 
Dont use the select expert. If your formula is complex it will get confused.

Edit the record selection formula directly with Report/Edit Selection Formula/Record.

You have total control over fields and brackets there.

Editor and Publisher of Crystal Clear
 
I see, you weren't editing the record selection formula, you were trying to use the Expert, generally a bad idea on many levels.

I never use any of the wizards/experts in Crystal, they tend to make bad assumptions.

The formula looks sound, so please try it by selecting Report->Edit Selection Formula->Record

-k
 
Hello synapsevampire & chelseatech,

Thank you for your replys. I'm begining to see the problems associated with the Select Expert. Will not use in the future if possible.

Thank you all again for your posts!

- Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top