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

Sorting and displaying problem

Status
Not open for further replies.

eblattner

Programmer
Aug 10, 2000
33
I am trying to select records from a table. I want to display a field called ID. But I want to do this based on 4 fields called "what and a field called "Status". I have attached a small table as an example. I am using a formula like this.

If {table1.id.what} = "POLREP" and {table1.id.status} = "D"
and
If {table1.id.what} = "PROPSET" and {table1.id.status} = "D"
And
If {table1.id.what} = "INSVER" and {table1.id.status} = "D"
And
If {table1.id.what} = "DEM" and {table1.id.status} = "N"


I have used many variations of this formula as a record selector in Crystal Reports 8. It works fine until I add the last line for "DEM"
 
You ifs above have no thens. Try something along these lines:

If {table1.id.what} in [&quot;POLREP&quot;,&quot;PROPSET&quot;,&quot;INSVER&quot;] and{table1.id.status} = &quot;D&quot; then <<result 1>>

else

If {table1.id.what} = &quot;DEM&quot; and {table1.id.status} = &quot;N&quot;
then <<result 2>>

Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
:) You have given Crystal an impossible task...this formula can NEVER evaluate to True

Why?....because there can only ever be one value for {table1.id.status} In your formula , since all the if nests are linked with &quot;and&quot; , {table1.id.status} must have the value of <b>both</b> &quot;D&quot; and &quot;N&quot; to select a record.

perhaps you should use &quot;OR&quot; instead of &quot;AND&quot; for the last criteria.

I might suggest an better format for this record selection formula

({table1.id.what} in (&quot;POLREP&quot; , &quot;PROPSET&quot; ,&quot;INSVER&quot; ) and
{table1.id.status} = &quot;D&quot;) <b>OR</b>
({table1.id.what} = &quot;DEM&quot; and {table1.id.status} = &quot;N&quot;)
Jim Broadbent
 
Sorry I didn't do the bolding properly remove my references to <b> and </b> Jim Broadbent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top