cancel
Showing results for 
Search instead for 
Did you mean: 

How to take only the decimals of an amount in Adobe Form?

marlincatari
Discoverer

Hi, The purpose is to show only the decimals of an amount, for example, the amount is 1,800.00, take the 00 and show it like this: 00/100, if the amount is 1,700.51, show 51/100, I hope you can help me, thanks.

View Entire Topic
PascalBremer
Advisor
Advisor

Hi Marlin,
you can extract the decimal value via modular operation.
It should work like this: x,yy * 100 mod 100 = yy
After this you just add the suffix.

This would look like this:

FormCalc: TextField1 = Concat( Mod($*100, 100) , " / ", "100" )

Javascript: TextField2 = (parseFloat(this.rawValue) * 100 % 100) + " / " + "100"

The scripts assume they are placed in a decimal field and overwrite the content of another text field.
You can adjust this to your form.

Best regards
Pascal