Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

What am I doing wrong with this calculation?

Avatar

Former Community Member
I have 3 numeric fields. NumericField3 calculates the entry of field1 and field 2..here is my code: (NumericField1*NumericField2)*12. The result in Field 3 calculates correctly but doesn't format it to currency if the result is larger than $9,999.00. as long as my result is below the $9,999 the calculation correctly formats the currency. But if the result is higher than $9,999.00 it just puts in the correct number but no currency formatting;ie; 12134 instead of $12,134. Can someone help me here. I'm comopletely new to this..

Mike.
1 Reply

Avatar

Former Community Member
I think the problem is with the Display Pattern you're using for the numeric field.



I'm guessing you picked a Display Pattern (on the Object palette's Field tab) of "$9,999.99". This type of pattern will always show exactly 6 digits. If there aren't 6, it'll replace the missing ones with zeros (0). If there are more than 6, it'll fill-in what it can and drop the rest (as you're seeing).



I believe you have two options: You can either add a bunch of "z" tokens prior to the "9"s to make the extra digits "conditional" or add a bunch of "Z" tokens to make them act as place-holders for missing digits.



The difference is this:



If you make your pattern "$zzz,zz9,999.99" and enter "123456" as the value, you'll get:



$123,456.00


If you make it "$ZZZ,ZZ9,999.99" and enter the same value, you'll get:



$ 123,456.00


Notice the 3 spaces at the beginning of the second option.



I've attached a sample form which demonstrates the two options using numeric fields with default values.



Stefan

Adobe Systems