0

I have a small problem. I´m using culture-codes to put the value into the correct format.

used culture code: de_CH I was hoping to get this format: CHF 18.99 But I got that: Fr. 18.99

I used this documentation: https://help.salesforce.com/articleView?id=admin_supported_locales.htm&type=5

Somebody with an idea out there?

Thanks in advance!!!

0

It is really strange but you are right.

If you retrieving the language_country(DE_CH) from a DE or a list, you may write something like that to replace it:

SET @currency = FormatCurrency(1234.567,@language_country)

IF @language_country == "de_CH" OR @language_country == "fr_CH" THEN
SET @currency = Replace(@currency,'fr.','CHF')
ENDIF
1

Since it's currency, and language doesn't matter, you could remove the language portion of the culture code and pass just the 'CH' value.

That might look like this:

SET @locale = [locale from audience]
SET @localeRows = BuildRowSetFromString(@local, '_')

/* if @locale is format [language]_[country], set currency locale to the 3rd element of the rowset, else set it to the @locale value */
SET @currencyLocale = IIF(rowCount(@localeRows) == 3, Field(Row(@localRows,3),1), @locale)
SET @orderTotal = FormatCurrency(@orderTotal,@currencyLocale,2,)

Also, this is probably the most accurate depiction of which locales formatCurrency() will support: https://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo(vs.71).aspx

And, honestly, you can just override the currency symbol if you'd like using the fourth parameter of formatCurrency, if it's returning something you don't want:

SET @orderTotal = FormatCurrency(@orderTotal,@locale,2,IIF(@locale == 'DE_CH', 'CHF', ))
0

@Sam: I tried your last idea but it doesn't work. I guess I made a mistake by using your term in my function.

My working function (except the CH case) before:

set @dynamicprice = Concat("%", "%=FormatCurrency('",@Product1_price,"','",@culturecode,"')=%", "%")

function afterwards:

set @dynamicprice = Concat("%", "%=FormatCurrency('",@Product1_price,"','",@culturecode,"'IIF(@culturecode == 'de_CH', 'CHF', ))=%", "%")

I am getting that error message: enter image description here

  • 1
    The error message looks like there is a missing comma in front of IIF – Johannes Schapdick Aug 3 '18 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.