6 Replies Latest reply on Oct 16, 2015 10:06 AM by jasonz82977625

# Multiply 2 fields Question

I have a Weight and Quantity field i would would like to auto update the weight based on the quantity.

This is the scrip i used

```var a = this.getField("QT 1").value;
var b = this.getField("Weight 1").value;
event.value = a * b ;

```

Works great  but if i go back and change the quantity it multiples the new quantity with the current weight

so how do it get it to store a default weight that is entered .

so if i enter quantity 2 and a weight of 4  equals 8 then change my mind to quantity 5 it does not do 5*8

So how do i store the first entered value

• ###### 1. Re: Multiply 2 fields Question

Why would you want to do that? It would cause your field to have an incorrect value.

• ###### 2. Re: Multiply 2 fields Question

i may have miss worded that the problem is

i forgot to state i only have 3 text boxes Item quantity and weight

i do quantity of X  and my base weight of Y it does X*Y

the problem is if i change the quantity it will take the result of the last entered value and does X* current weight

so i enter quantity of 1 and weight of 4 no problem if i change the quantity 99

If i enter quantity 3 and weight of 4 the 4 becomes 12

if i then change the quantity 3 to 4 it will do 4*12 not 4*4

i guess what i could do is go to a auto fill item list and make a hidden base weight field to make it easier.

I was over thinking the problem  when the easy answer is a bit more work but will work out better in the long run

• ###### 3. Re: Multiply 2 fields Question

This sounds like an issue with the field calculation order. Is any of the other fields also calculated?

• ###### 4. Re: Multiply 2 fields Question

Ok i give up on this one i moved the calculation to the top of the calculation order and it still messing up, if you still have my  google drive link the PDF is in the folder on page 3 if i enter QT 1 Weight 4 for item on then do QT 2 weight 4 for item 2 and QT 3 Weight 4 for item 3

Item 1 Weight is 4

Item 2 Weight is 32 should be 8 if i change the  QT to 3

Item 3 Weight is 12

• ###### 5. Re: Multiply 2 fields Question

Info: The calculation order goes from top to bottom.

• ###### 6. Re: Multiply 2 fields Question

yes, 35 in total and they are the first 35 in the calculation order in alphanumeric Order. from