I could not get the currency right in the data mapper, so I went with what is below.
var field, result = “”;
field = record.fields[“gesamtsumme_brutto”].replace(“-”, “”).replace(“\u20AC”,“”).trim();
if (field !== “”) result += “(” + field + “)” + " \u20AC";
results.html(result)
EDIT: Sorry I overlooked the Euro symbol. Updated code.
In the Designer you can use the formatter object in your User scripts (e.g. the scripts residing in the Scripts pane). The formatter object lets you format values of common field types like numbers, currencies and dates.
Several functions allow you to specify a pattern. The following pattern will wrap negative values with parenthesis.
var field, result = "";
field = record.fields.somefield;
result = formatter.number( field, '#,##0.00 €;(#.##0,00) €');
results.html( result );
See the online help for more information on these patterns.
Thank you, it works great but the variable is on a detail table, therefore there are multiple line items and they could be positive and negative values, applying this script all numbers show up in parenthesis