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

  • Author
    Posts
  • #22708 Score: 0

    Mike Kennedy
    • Contributions: 0
    • Level 1

    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 Score: 0

    pcutler
    • Contributions: 0
    • Level 1

    are you looking for

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

  • #22710 Score: 0

    Mike Kennedy
    • Contributions: 0
    • Level 1

    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 Score: 0

    BrianE
    • Contributions: 0
    • Level 1

    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.