cancel
Showing results for 
Search instead for 
Did you mean: 

Internationalization Formatter and Type Formatter in a Rule

Angelo_Ab
Participant
0 Kudos
75

Hi,

here is explained how to use Formatters in a Control Attribute:

https://help.sap.com/doc/f53c64b93e5140918d676b927a3cd65b/Cloud/en-US/docs-en/guides/getting-started...

Is there a way to use this Formatters programmatically in a Rule ?

For Example the Number is 1000 and Currency is EUR if I use this Syntax $(C, 1000, EUR, it-IT in an Control Attribute it shows correctly and the result is 1.000,00 €

In JavaScript the way to do this is as follows:

let Text = Num.toLocaleString("it-IT", {style:"currency", currency:"EUR"});

The problem using this in a Rule is that the currency symbol is not shown and the result is 1.000,00

Thank you.

Accepted Solutions (1)

Accepted Solutions (1)

bill_froelich
Product and Topic Expert
Product and Topic Expert

You need to call the MDK clientAPI formatting functions in your rule.  For currency you would call clientAPI.formatCurrency.

context.formatCurrency(1000,'EUR','it-IT','{maximumFractionDigits:2,useGrouping:true}')
"1.000,00 €"

 

Answers (0)