Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Need help in formating a form dealing with negative currency

Avatar

Level 1

Need Help!!!

Creating forms in Adobe acrobat Pro I could format a number cell to calculate additions/subtractions of currency. If the result was negative I could get the cell to show the negative result in red text and show parentheses around them. How can I do that in LiveCycle?

If i have to use formcalc - what would i type in?

5 Replies

Avatar

Level 6

In LiveCycle can be done using the Numeric Field object and some formcalc script.

Use the "Numeric Field" from the Object Library. For the Field patterns (Select the placed numeric field, On object Window Object -> Field) use "num.currency{}" to show the currency(Ex: $) and "parentheses" if its negative. Write some script to show red text/border in red .

On exit event of the Numeric Field here is the script:

if($.rawValue <0) then $.font.fill.color.value = "255,0,0" endif  // This will make entire text in red color if the value is negative.

if($.rawValue <0) then $.validate.nullTest = "error" endif      //This will make border of the field in red color if the value is negative.

Hope this helps.

Avatar

Level 1

Raghu,

Thank you for your response.

Q: Same question but - What would it be if it was a negative interger?

Avatar

Level 6

To work for both type of currency formats (Integer($1) and/or Decimals($1.99)), use the pattern as "num{($z,zzz,zzz.zz)}" instead of "num.currency{}". Script will be the same for any pattern.

"num{($z,zzz,zzz.zz)}": z - if digits present it shows, if not it ignores. This will work for -Ve, +Ve integers/decimals too.  instead of "z" if placed "9" it act as mandatory. ex: "num{($z,zzz,zzz.99)}". it always gives 2 trailing digits for input numbers.

Avatar

Level 1

Actually, I am refering to an actual numberic interger. like 1,2,3,4...etc

Not currency.

Would it be the same as above?

Avatar

Level 6

Yes. Same pattern will work, but do need to remove the "$" sign, it should be like: "num{(z,zzz,zzz.zz)}".