Expand my Community achievements bar.

SOLVED

How to set the num.currency{} such a way that it will display "-" sign for Negative numbers instead of "()"

Avatar

Level 1

Hi Adobe folks,

I am working on a Adobe invoice form, where in few currency fields might need to show as "-" if it is negative number.

I am using Display pattern num.currency{}, but its displaying it as ($1,234,567.89), I want this to display as $-1,234,567.89

Can anyone please let me know how to achieve this.

2-25-2016 1-16-10 PM.jpg

2-25-2016 1-27-20 PM.jpg

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

I did wonder if it would be that easy.  It does seem that US and Hong Kong are the only ones that use the brackets for negative numbers.  The Australian currency displays as you want.  Maybe you can go into the XML Source and change the line <numberPattern name="currency">$z,zz9.99|($z,zz9.99)</numberPattern> to <numberPattern name="currency">$z,zz9.99</numberPattern> .  Which is how the Australian one looks ... would need some testing though.

Or maybe you can have the decimal field hidden and display a text field with a calculation like DecimalField.formattedValue.replace(/[()]/g,"");. Do you need to line up the decimal points?

Bruce

View solution in original post

4 Replies

Avatar

Level 10

Hi,

Try using a display pattern of num{$z,zzz,zzz,zzz,zz9.99}

Regards

Bruce

Avatar

Level 1

I can use num{$z,zzz,zzz,zzz,zz9.99} to make it display -ve sign, but that defeats my main purpose, which is formatting the amount as per the Currency code. (For example if its USD it prints with 2 decimals like 22.33, and if its Japan currency, it prints without decimals 22)

That's the reason i wanted to use num.currency{} but want to print -ve numbers without braces.

Any help in achieving the "-"ve sign instead of "()" using num.currency{} would be highly appreciated !!

Avatar

Level 1

I can use num{$z,zzz,zzz,zzz,zz9.99} to make it display -ve sign, but that defeats my main purpose, which is formatting the amount as per the Currency code. (For example if its USD it prints with 2 decimals like 22.33, and if its Japan currency, it prints without decimals 22)

That's the reason i wanted to use num.currency{} but want to print -ve numbers without braces.

Any help in achieving the "-"ve sign instead of "()" using num.currency{} would be highly appreciated !!

Avatar

Correct answer by
Level 10

Hi,

I did wonder if it would be that easy.  It does seem that US and Hong Kong are the only ones that use the brackets for negative numbers.  The Australian currency displays as you want.  Maybe you can go into the XML Source and change the line <numberPattern name="currency">$z,zz9.99|($z,zz9.99)</numberPattern> to <numberPattern name="currency">$z,zz9.99</numberPattern> .  Which is how the Australian one looks ... would need some testing though.

Or maybe you can have the decimal field hidden and display a text field with a calculation like DecimalField.formattedValue.replace(/[()]/g,"");. Do you need to line up the decimal points?

Bruce