cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Reports 2013 Suppressing a field based on a condition

0 Kudos

Hello,

I have created labels in Crystal that include a 'Item Number' field and a 'PO' number field.

However our customer wants to suppress the PO number if it does not equal an item number that starts with '1.CLA*'. So, I right-clicked on the PO number field and suppressed it using this formula but it wants to suppress the PO number for all items numbers instead of all item numbers but 1.CLA*.

{ARINVT.ITEMNO}<> "1.CLA*"

I also tried some other formulas using IF THEN statements but can't get it to work. I've searched the web, etc and can't seem to find a direct answer. Thanks!

vitaly_izmaylov
Employee
Employee
0 Kudos

Can you provide some examples of PO Number and Item Number values?

Accepted Solutions (1)

Accepted Solutions (1)

DellSC
Active Contributor

<soapbox> If your formula returns a true/false value, you do NOT need the "If..Then..Else". </soapbox>

When working with nulls, you have to check for null before checking for a value. This is in the nature of how databases deal with null which means "no value". When you compare a value with a null value, the result is null, not true or false.

So, I would do the formula as this:

IsNull({ARINVT.ITEMNO}) or not ({ARINVT.ITEMNO} startswith "1.CLA")

This will suppress the PO number if the Itemno is null or if it does not "1.CLA".

-Dell

Dell.. Okay Awesome! I learned something new today. I was fixated on the TRUE/FALSE statements and never knew about checking for Null first. Thanks for your help and have a nice day!

Answers (2)

Answers (2)

DellSC
Active Contributor
0 Kudos

If your formula evaluates to "True", the field will be suppressed. So, your formula is working correctly as defined, it's just not what you want. Try this instead:

left({ARINVT.ITEMNO}, 5) = "1.CLA"

-Dell

0 Kudos

Thanks Dell!

I at least partially figured this out. Now this is what I did.

IF {ARINVT.ITEMNO} startswith "1.CLA*" THEN FALSE

This one line made the PO just show up on the 1.CLA item numbers but it also still allows the PO number to show up for item numbers that are blank or NULL.

So, I tried adding this to the formula above.

IF {ARINVT.ITEMNO} startswith "1.CLA*" THEN FALSE

ELSE

IF ISNULL ({ARINVT.ITEMNO}) THEN TRUEHowever, the IF ISNULL formula didn't help so the PO number still shows up for labels that don't have a Item Number. So, I'm not sure what to do in regards to making the PO number not show if the item number is blank/NULL. Thanks!

0 Kudos

Yes. Thank you!

Item number values / PO number values

1.GLA012 / 4500974167

1.GLA016 / 4500981449

1.CLA005 / 4500997649