We have a use case where we send data to the Adobe API for document generation. This data includes numbers that need to be formatted as currency (e.g., $ xxx,xxx.xx) in the generated document. Are there any out-of-the-box methods or functions available that can be used in an activity to format a decimal value into a currency? Thank you in advance.
Hi , @kasis
For your use case if you create the Currency type property using PxCurrency control in this case and use it in your section then the value 1000 is converted to $1,000.00.
In the Format sidebar, click the Cell tab, then click the Data Format pop-up menu and choose Currency.
or please check if there is any NumberFormat() function available in pega as like javascript.
@Somil0607 In the UI, the currency is formatted as $1,000.00, but when copied to the clipboard, it appears as 1000. We need to send the clipboard data as JSON to the Adobe API for document generation. Is there a function available that can be used in an activity to format the currency?
@kasis
What is the property type you’re using?
@kasis It depends on property type.
@kasis Please use currency type property.
@BalasubramaniV2199 How can we define the properties of a currency? Any suggestions?
@kasis following code snippet worked in the function
java.text.DecimalFormat df = new java.text.DecimalFormat("#,###.##");
return df.format(InputNumber);
@Somil0607 It’s a property of type decimal. Do you have any engine API that I can consume in the function to format a decimal value into currency?