Jump to content

rule to convert negative dollars to use of parentheses


jbq

Recommended Posts

Posted

is there a way to write a rule that will add parentheses to financial data instead of the (-)negative? I know excel has the formula, but it is lost in .csv file

 

I see the Negative as Red rule, but that's not what they want. Wondering if anyone has already figured this out. any help is appreciated. Thanks

Posted

Assuming your data includes the minus sign (-) at the beginning of negative values, would the following work?

return (Field("Amount").search(/-/)==0) ? "(" + Field("Amount").replace("-","") + ")" : Field("Amount");

Posted

Eureka!! :)You are the Guru! It worked great.

I got it to work, but I have several FIELDS to apply the rule to. I would like to have one rule ["to rule them all..."] that contains the definition for 12 fields ... do I need to create one rule for each FIELD, or do you have more magic to share. Thanks so much.

jbq

Posted
You can either create a separate rule for each field (duplicate rule and update field info) or create a FOR loop to cycle through all fields in one rule (may have to create an array from all the data first). If you choose the latter, the "rule creator" would need to know how the result needs to be formatted first (space/tab/line break between results?).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...