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.

Accepted Solutions (1)

Accepted Solutions (1)

BEKOStan
Active Participant
0 Kudos

Hi marlin.catari ,

I tried to get the decimal part but didn't try to format, maybe this helps you anyway.

I have two Text Fields called debug1 (has binding to a decimal value) and debug2 (has script). In the script I read the value from debug1 and split it as you need it, afterwards it will be shown in debug2.

What's still missing is your formatting. I will give that a try later (or you get this done in the mean time).

Best regards

Andreas

BEKOStan
Active Participant

Quick and dirty modification 😉

marlincatari
Discoverer

Thanks So much!!! I could solve, excellent answer.

Answers (1)

Answers (1)

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