Code
-------------------------
a!localVariables( local!currencyValue: a!currency( isoCode:"USD", value:-152552.774, format:"SYMBOL", decimalPlaces:2, indicatorAlignment: "START" ), stripwith( local!currencyValue, "$" ) )
Output
--------------------------
"(152,552.77)"
I need the output as "152,552.77".Can some one help to rectify the code
Discussion posts and replies are publicly visible
Hi akhileshr0549 kindly please use this code.
a!localVariables( local!currencyValue: a!currency( isoCode:"USD", value:-152552.774, format:"SYMBOL", decimalPlaces:2, indicatorAlignment: "START" ), local!data:stripwith( local!currencyValue, "$" ), local!data1:split(local!data,")") ,local!data2:split(local!data1,"("), local!data2[2])
a!localVariables( local!currencyValue: a!currency( isoCode:"USD", value:-152552.774, format:"SYMBOL", decimalPlaces:2, indicatorAlignment: "START" ), stripwith( stripwith( local!currencyValue, "$" ), "()" ) )
Additional strip with would work fine on the output.
Have you tried fixed function instead?
stripwith( fixed( "-152552.774", 2 ), "-" )
hi akhileshr0549 could try this code and let me know is that working fine.
a!localVariables( local!currencyValue: a!currency( isoCode:"USD", value:-152552.774, format:"SYMBOL", decimalPlaces:2, indicatorAlignment: "START" ), stripwith(stripwith( local!currencyValue, "$" ),"()") )
Why not multiply the value with -1 in case it is negative?
If you're looking for the Absolute Value of a number, there's already an Appian function for that:
docs.appian.com/.../fnc_mathematical_abs.html
akhileshr0549 said:I need the output as "152,552.77"
Why are you using a!currency() if you don't actually want the output in currency?
If you just need the output formatted with commas and a fixed decimal, just use "fixed()".
As I mentioned before, you can get the absolute value of the input number using "abs()".
fixed( abs(-152552.774), 2, false() )
As I always say - the Functions Doc Page is your friend!! Keep it open in a browser tab!