Skip to Content

Crystal Reports 2013 Suppressing a field based on a condition


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*.


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!

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    Jan 07 at 08:46 PM

    <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".


    Add comment
    10|10000 characters needed characters exceeded

    • 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!

  • Jan 04 at 04:24 PM

    Yes. Thank you!

    Item number values / PO number values

    1.GLA012 / 4500974167

    1.GLA016 / 4500981449

    1.CLA005 / 4500997649

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 07 at 05:04 PM

    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"


    Add comment
    10|10000 characters needed characters exceeded

    • 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


      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!