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!

Formula to check for keywords in detail line(s) to enable formatting.

Status
Not open for further replies.

sl71

IS-IT--Management
Apr 24, 2003
4
AU
I have a Crystal Report which is acting as an Invoice.

My Detail Section contains a Product Name field which can contain records

Consulting
Consulting 2
Consulting 3
Parts

There is often a mixture of these items in a report.

I wish to suppress a text field in the Page Footer section of the report if “Consulting 3” appears anywhere in the detail section. (Ideally I would also like to suppress other text fields based on the response from the query.)

I have a formula to look for “Consulting 3”

//@Consult
If {Product Name}=”Consulting 3”
Then 1
Else 0

My suppression formula for the Text field is

//@Suppression
Sum({@Consult})>0

My formula works well when there is a Single Entry for Consulting 3 in the Detail Section but fails when additional lines are entered.

If I place the @Consult formula in the Page Header Section a value of 1 is returned for both a single Consulting 3 entry as well as a multiple Entry of other items (one of which is the Consulting 3 item). This is the behavior I would like to occur globally for the report.

When this formula is moved to the Page Footer section it will only return a value of 1 when Consulting 3 is present as a single entry.

Does anybody have any suggestions how I can get this to work?

Thankyou


 
Place a formula:

sum({@Consult})

...in the report header, and then use your suppression formula of:

Sum({@Consult})>0

...for the page footer text.

-LB
 
Thankyou for your assistance lbass.

Have tried what you suggested but it suppressed no matter whether Consulting 3 was present or not.

Appears the Sum formula counts the number of Consulting 3's present for the total print run (in my Example 10 invoices with Consulting 3 appearing 2 times), returns the sum value of 2 and hence the suppression will alaways be applied.

How can I get the Sum to change per invoice?


 
Please note that you did not indicate in your first post that you meant to suppress per group--in fact, you didn't mention a group. Try using:

Sum({@Consult},{table.invoice}) > 0

-LB

 
Thanks lbass. After I implemented your second formula it worked perfectly. I realise I was a little short on detail in my description and greatly appreciate your assistance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top