This topic contains 4 replies, has 0 voices, and was last updated by tavanpat 8 years, 6 months ago.

  • Author
    Posts
  • #2769

    tavanpat

    Hello,

    I have a formula field

    CASE WHEN {custrecordsfcountry} = ‘Cyprus’ THEN ‘CY’

    WHEN {custrecordsfcountry} = ‘South Africa’ THEN ‘ZA’

    when {custrecordsfcountry} = ‘Ukraine’ then ‘UA’

    when {custrecordsfcountry} = ‘Turkey’ then ‘TR’

    when {custrecordsfcountry} = ‘Tunisia’ then ‘TN’

    when {custrecordsfcountry} = ‘Senegal’ then ‘SN’

    when {custrecordsfcountry} = ‘Saudi Arabia’ then ‘SA’

    when {custrecordsfcountry} = ‘Russian Federation’ then ‘RU’

    when {custrecordsfcountry} = ‘Reunion’ then ‘RE’

    when {custrecordsfcountry} = ‘Qatar’ then ‘QA’

    when {custrecordsfcountry} = ‘Oman’ then ‘OM’

    when {custrecordsfcountry} = ‘Mauritius’ then ‘MU’

    when {custrecordsfcountry} = ‘Monaco’ then ‘MC’

    when {custrecordsfcountry} = ‘Morocco’ then ‘MA’

    when {custrecordsfcountry} = ‘Latvia’ then ‘LV’

    when {custrecordsfcountry} = ‘Lithuania’ then ‘LT’

    when {custrecordsfcountry} = ‘Lebanon’ then ‘LB’

    when {custrecordsfcountry} = ‘Kazakhstan’ then ‘KZ’

    when {custrecordsfcountry} = ‘Kuwait’ then ‘KW’

    when {custrecordsfcountry} = ‘Jordan’ then ‘JO’

    when {custrecordsfcountry} = ‘Israel’ then ‘IL’

    when {custrecordsfcountry} = ‘Estonia’ then ‘EE’

    when {custrecordsfcountry} = ‘Bahrain’ then ‘BH’

    when {custrecordsfcountry} = ‘Armenia’ then ‘AM’

    when {custrecordsfcountry} = ‘United Arab Emirates’ then ‘AE’

    else ‘ ‘

    END

    and I get an error ” ERROR: Invalid Expression”

    If I put only CASE WHEN {custrecordsfcountry} = ‘Cyprus’ THEN ‘CY’

    else ‘ ‘

    End

    it works

    Really don’t understand why I get this error if I put mor than 1 When… then

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

  • #2770

    girieshg

    tavanpat Not completely sure about this, but the syntax might be incorrect. Try this and see if you get the expected result.

    CASE {custrecordsfcountry} WHEN ‘Cyprus’ THEN ‘CY’

    WHEN ‘South Africa’ THEN ‘ZA’

    WHEN ‘Ukraine’ THEN ‘UA’

    ELSE ‘ ‘

    END


    MikeBucklaew replied on 05/13/2016, 12:23 PM: I started to answer and the phone rang. I didn’t see your response until I clicked Post

  • #2771

    Bednar

    tavanpat Mentioned this in the other post, but thought I’d share it here too – you’ve got smart quotes around everything starting with Ukraine; that might be the problem (‘Ukraine’ versus ‘Ukraine’).


    MikeBucklaew replied on 05/13/2016, 12:22 PM: I started to answer and the phone rang. I didn’t see your response until I clicked Post

  • #2772

    MikeBucklaew

    At first glance it looked OK to me. When I zoomed my browser, I noticed some of the single quotes were different. I’m not sure if it’s this way in your actual search but that may be the issue. For instance Cyprus and South Africa have the normal single quotes but all the rest have open and close single quotes on the country name but normal single quotes on the two letter abbreviation.

  • #2773

    tavanpat

    Yes true seems single quotes are different, replace them and modify by

    CASE {custrecordsfcountry} WHEN ‘Cyprus’ THEN ‘CY’

    WHEN ‘South Africa’ THEN ‘ZA’

    and it works

    Thanks a lot

You must be logged in to reply to this topic.