This topic contains 3 replies, has 0 voices, and was last updated by BrianE 6 years, 9 months ago.

  • Author
    Posts
  • #22708

    Mike Kennedy

    I'm trying to figure out how to get this to work.

    Code:
    CASE WHEN {shipaddress1} IS NULL THEN {shipaddress2} // Works
    ELSE (
    CASE WHEN {shipaddress1} IN 'Attn: ' THEN {shipaddress2} // Does not Work
    ELSE {shipaddress1} // It allway goes here
    END
    )
    END
    If shipaddress1 has "Attn:" at the beginning, then I want to print shipaddress2 instead

    Thanks
    This is a cached copy. Click here to see the original post.

  • #22709

    pcutler

    are you looking for

    Code:
    CASE WHEN {shipaddress1} LIKE 'Attn:%' THEN…

  • #22710

    Mike Kennedy

    That worked.

    Thanks PCutler

    Code:
    CASE WHEN {shipaddress1} IS NULL THEN {shipaddress2}
    ELSE (
    CASE WHEN {shipaddress1} LIKE 'Attn:%' THEN {shipaddress2}
    ELSE {shipaddress1}
    END
    )
    END

  • #22711

    BrianE

    The two levels of case statements are not really needed:

    Code:
    CASE WHEN {shipaddress1} IS NULL THEN {shipaddress2}
    WHEN {shipaddress1} LIKE 'Attn:%' THEN {shipaddress2}
    ELSE {shipaddress1}
    END

You must be logged in to reply to this topic.