Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

calculate a box and put result in another

Avatar

Level 2

I'm trying to get the multiple of a decimal box so for example

Box1 will have the number 100

You then need to tick a check box to multiply it

Box2 will store the answer

I have the following but it doesn't work

var Aprox = topmostSubform.IFFPage6.Page.FirstCustomer.decApproxNetIncom.rawValue

Aprox=Aprox*7

topmostSubform.IFFPage9.Page.decFirstExpend.rawValue = Aprox

**THIS CODE IS PLACED ON THE MULTIPLY BUTTON**

It's also a click function as I have another button that I want to do a divided by 12

Any help would be great

1 Accepted Solution

Avatar

Correct answer by
Level 2

I've fixed this by using the following:

var currency =  topmostSubform.IFFPage6.Page.FirstCustomer.decApproxExpend.rawValue *7;

var currency1 = topmostSubform.IFFPage6.Page.SecondCustomer.decApproxExpend.rawValue *7;

var currency2 = topmostSubform.IFFPage6.Page.SecondCustomer.decJointApproxExpend.rawValue*7;

          topmostSubform.IFFPage9.Page.decFirstExpend = currency;

                              topmostSubform.IFFPage9.Page.SecondCustomer.decSecExpend = currency1;    

          topmostSubform.IFFPage9.Page.decJointExpend = currency2;

View solution in original post

5 Replies

Avatar

Level 5

Under which event did you write the script and the Language formcalc / JavaScript

Check whether the path of the fileds are correct or not ?

topmostSubform.IFFPage9.Page.decFirstExpend.rawValue = topmostSubform.IFFPage6.Page.FirstCustomer.decApproxNetIncom.rawValue * 7;

You can avoid using the other variable if you use above script.

Thanks

Vjay

Avatar

Level 2

Vjay,

I'll try your way now. I've slightly changed how I've gone about it, I created a function named Seven and on a click told the tick button to run that function. I'll add your Java into that function now.

Avatar

Level 2

Vjay,

Sadly that didnt work. Im doing it under the change event also.

Regards

Avatar

Level 5

Maybe this could help you:

step1.jpg

And then you use the following script in the calculate event of the box2 field.

step2.jpg

Hope it will helps you,

Mandy

Avatar

Correct answer by
Level 2

I've fixed this by using the following:

var currency =  topmostSubform.IFFPage6.Page.FirstCustomer.decApproxExpend.rawValue *7;

var currency1 = topmostSubform.IFFPage6.Page.SecondCustomer.decApproxExpend.rawValue *7;

var currency2 = topmostSubform.IFFPage6.Page.SecondCustomer.decJointApproxExpend.rawValue*7;

          topmostSubform.IFFPage9.Page.decFirstExpend = currency;

                              topmostSubform.IFFPage9.Page.SecondCustomer.decSecExpend = currency1;    

          topmostSubform.IFFPage9.Page.decJointExpend = currency2;