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

Formula Question???? 1

Status
Not open for further replies.

MrWilly

MIS
Nov 9, 2001
36
US
I am looking to create a formula (in Select Expert) that will display records based on a value in a particular field.

For example:
If I have two transaction records in a history table, each one is a distinct record with a different value in the 'type' column (x and y), what is the formula to tell crystal to only display the record with 'x' in the type column (suppress the 'y' record)?

If there is only one record (type = y), this should show.

Can anyone help?

Crystal 8.0, SQL 7.0 database.
Muchos Gracias!
 
Use the record selection criteria (Report->Edit Selection Criteria->Record):

{MyTable.MyType} <> 'Y'

or use:

{MyTable.MyType} = 'X'

The first filters out the Y's, the latter gives you only X's

-k kai@informeddatadecisions.com
 
Thanks for the prompt reply!

Is is possible to create a variable statement that will check for a 'Y' record and if it does not find one - it will display the 'X' record?
But, if it does find one, it will supress the 'X' record and only display the 'Y'.



 
Sure:

An easy way is to sort on the value field, now place something like this in the suppress of the value field:

If next({whatever uniquely qualifies these 2 records as a set}) = {whatever uniquely qualifies these 2 records as a set}
and
next({value}) = &quot;Y&quot;

This will check the next record for the value of Y and suppress the X it if it exists, otherwise it will show Y because the suppression formula won't work on the 'Y'.

-k kai@informeddatadecisions.com
 
just to qualify what SV has said....this is not done in the Record Select...rather you would process this formula in a section of the report

The reason for this is that Crystal doesn't know what the next record is until all of the data has been brought in. Jim Broadbent
 
Thanks! I really appreciate the help!

But...

I am having trouble entering the formaula SV provided in the Suppress(No Drill Down) formula screen on the Section Expert of the Details section.

I have entered the following:

if next ({tblxxxReference}) = {tblxxxReference}
and
next ({tblxxxType}) = 'X'

Error check is telling me I need a 'then' statement after the 'X'.

Please let me know if I'm way off here....

Many thanks!
 
Remove the 'If' from SynapseVampire's formula.
 
As Naith said removing the &quot;if&quot; is the answer. These types of formulas are booleans, they must evalaute to either true or false. In your case it will suppress the fields if the formula evalautes to true. With an &quot;If&quot; at the begining of the formula, it does not evaluate to anything, hence the error. Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top