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

Supress a text object conditionally 3

Status
Not open for further replies.

tucktuck

Technical User
Mar 1, 2012
3
GB
I need to supress a text object located in a report footer so that it only shows when a certain stock code is present in the details section.

I have tried 'if then':

if({stock.code})="T002")then false else true

but this doesn't have the desired result in that it fails to appear at all.
Using the above formula does it matter that T002 is not the entire code?
The code in question is a top level code and has a series of user changeable variables attached to it in the database, which create the final complete code. for example T002 is the top code for creating a stock item for a marquee of a given size and length.

Essentially what I need to achieve is that when there are marquee elements of the order I need the text object to visable in the report footer but if it is a catering order with no marquee then it needs to be supressed.

I also tried

instr({Stock.CODE},"T002")=0
which also has no effect on the behaviour of the text object.

In both situations the formula does not throw up any errors.

Rather than by stock code, is it possible to suppress the text object unless a specific word is present within the description?

The form is setup like this:


QTY Description Replacement Val Price Ea Total

1 6m x 12m Marquee 2978.00 413 413


In the above example, '6m' and '12m' are variables with the only constant being the word 'Marquee'

The full decription within the database is:

6m x {A}m Marquee with high grade, fire retardant PVC - {B}{D}{C}{E}{F}

So I was thinking:

Lookslike({INVBODY.DESCRIPTION},"*Marquee*")=false

with this example the text object shows on Marquee contracts but also on all other contracts as well.

I have another report which contains the same tables but uses different fields where the following formula works fine:

instr({Stock.CODE},"T002")=0

Am I missing something really obvious here???
 
Try this suppression formula:

not({stock.code} like "*T002*")

-LB
 
When dealing with text descriptors consider case sensitivity as well.

You asked if it was possible to suppress based on a specific word in the description as well as by code, yes you can do so. But it is good practise to standardise the input to your formula as much as possible to avoid confusion.

Use UCASE() to force a text input to all upper case for the purpose of comparison (in case entries can be 'marquee' or 'Marquee' etc).

IF UCASE({INVBODY.DESCRIPTION}) LIKE '*MARQUEE*' THEN false ELSE true

Very similar to where you were with the code but just remember to use your wildcards appropriately and consider all possible text inputs.

'J

CR8.5 / CRXI - Discovering the impossible
 
Thanks for your responses. niether of the formulas have worked but I now fear there may be an issue with some kind of Database level conflict.
I think I will consider rebuilding the database and coming back to this as other issues outside of Crystal have since become apparent.
I fear I have fallen foul of the situation that arises when you come in half way through a project and assume that those before you have done their jobs!!!!

Thanks again.

CT
 
If I understand it correctly, you want to suppress a text field in the report footer, based on the existance of data in the detail field. Your current approach will only work if the suppression test is satisfied in the last detail row of the report.

One way to deal with this (assuming I understand the problem correctly) is to create a formula as follows, and place it in the detail section:

{@TEST}:

If ({stock.code} like "*T002*") then 1 else 0



Enter a conditional suppression formula as follows:

Maximum({@TEST}) = 0
 
Good catch, pmax9999. I didn't read the initial post carefully enough. Your solution should work for the reason you state.

-LB
 
OK.......
None of the above solutions have worked independantly so as a final ditch attempt at some kind of workable solution I tried the following:

Create the formula {@TEST}

IF UCASE({INVBODY.DESCRIPTION}) LIKE '*MARQUEE*' THEN 1 ELSE 0

And inserted it into the details section

then conditionally supressed the report footer based on:

Maximum({@TEST}) = 0


This worked with the desired effect.

Thanks to all for your assitance.

CT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top