Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

FORMULAS - NEGATIVE RESULT

Avatar

Level 4

Working with formulas, if the amount is negative I would like it to automatically show the amount as (-20) rather than just -20.  Can you please advise me what I need to do.

Regards

Jenny

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Jen,

The display pattern you need is num{(szzzz)}

The "s" is the symbol to display the minus sign.  Any symbols that don't have a special meaning are displayed as themselves (like the "-").

The complete list is defined in http://partners.adobe.com/public/developer/en/xml/picture_clause_2.0.pdf

Regards

Bruce

View solution in original post

4 Replies

Avatar

Level 6

Hi,

You can do it with script:

$.rawValue = concat("(" , NumericField1.rawValue , ")"), field which shows this value should be TextField.

Also you can use patterns, for youre case use num{( -zzzz)}.

BR,

Paul Butenko

Avatar

Level 4

I tried the pattern but that didn't work.  If the formula resulted in a negative number i.e. -88 it gave me (-88) but if the formula resulted in a positive number i.e. 88 it would still give me -88. 

Jen

Avatar

Correct answer by
Level 10

Hi Jen,

The display pattern you need is num{(szzzz)}

The "s" is the symbol to display the minus sign.  Any symbols that don't have a special meaning are displayed as themselves (like the "-").

The complete list is defined in http://partners.adobe.com/public/developer/en/xml/picture_clause_2.0.pdf

Regards

Bruce