Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

doing math

Avatar

Level 1

If I have three boxes on my form and I put a number in box number one can I get box number two to calculate 20% of box number one and then have box number three give me the difference between box number one and box number two?

4 Replies

Avatar

Level 10

Hi,

Here is a sample:

https://acrobat.com/#d=vKH9VUsbBeug6h0jVup35g

The calculate event of field nr 2:

this.rawValue = number.rawValue * 0.2;

Calculate event of field nr 3:

this.rawValue = number.rawValue - number20.rawValue; 

Hope that helps,

Niall

Avatar

Level 1

Thanks for the help. I put this formula in and it did not work. So know I am even more confused.

Darrin K Sneddon

"True compassion is more than flinging a coin to a beggar; it comes to see that an edifice which produces beggars needs restructuring." Martin Luther King Jr.

Avatar

Level 1

OK I'm an idiot, I got it to work. Now I have a second problem, the numbers need to be dollar amounts so I need the trailing numbers to show even if they are zeros. I figured out the decimal box but not how to get the zeros to show.

Darrin K Sneddon

"True compassion is more than flinging a coin to a beggar; it comes to see that an edifice which produces beggars needs restructuring." Martin Luther King Jr.

Avatar

Level 10

Hi,

Glad you have it working. You can apply patterns to the data in your objects - see here: Re: still having problems with dropdown populate Script

Good luck,

Niall