This topic contains 4 replies, has 0 voices, and was last updated by tavanpat 8 years, 6 months ago.
-
AuthorPosts
-
May 13, 2016 at 11:18 am #23686
tavanpatHello,
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. -
May 13, 2016 at 11:37 am #23687
girieshgtavanpat 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
-
May 13, 2016 at 11:43 am #23688
Bednartavanpat 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
-
May 13, 2016 at 12:17 pm #23689
MikeBucklaewAt 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.
-
May 13, 2016 at 12:39 pm #23690
tavanpatYes 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
-
AuthorPosts
You must be logged in to reply to this topic.