Hi,
I am very new with Javascript and can't seem to get the result I want in a field. I have one field (GU4454.Skidders.Rate.1)that gets the rate from three other fields and have formatted it to 2 decimals. Another field uses that amount to get the premium but it is using three decimals instead of two. I'm not sure what the correct sytax is and can't find the information in Adobe help. I tried floor and round but neither gives me the correct result. What I want is to take 250000 * 1.43/100 to get 3575 but it uses 1.425 and gives me 3562. Here is what I have in the premium field:
var values = this.getField("GU4454.Skidders.Values.1")
var rate= this.getField("GU4454.Skidders.Rate.1")
var vNum = (values.value * rate.value)/100
var vNum1 = (values.value *1) /100
if((values.value !=0) && (rate.value ==0))
event.value = Math.round(vNum1)
if ((values.value !=0) && (rate.value !=0))
event.value = Math.round(vNum)
This is what is in the GU4454.Skidders.Rate.1 field:
var values = this.getField("GU4454.Skidders.Values.1")
var dedrate= this.getField("GU4454.Skidders.DedRate.1")
var load = this.getField("GU4454.Skidders.Load.1")
var mod= this.getField("GU4454.Skidders.Mod.1")
if (values.value !=0)
Math.floor(event.value = dedrate.value * load.value * mod.value)
if (event.value == 0)
event.value = ""
Any help with the correct syntax or where I can find help with Javascript calculations would be great. Thanks
Lisa
I am very new with Javascript and can't seem to get the result I want in a field. I have one field (GU4454.Skidders.Rate.1)that gets the rate from three other fields and have formatted it to 2 decimals. Another field uses that amount to get the premium but it is using three decimals instead of two. I'm not sure what the correct sytax is and can't find the information in Adobe help. I tried floor and round but neither gives me the correct result. What I want is to take 250000 * 1.43/100 to get 3575 but it uses 1.425 and gives me 3562. Here is what I have in the premium field:
var values = this.getField("GU4454.Skidders.Values.1")
var rate= this.getField("GU4454.Skidders.Rate.1")
var vNum = (values.value * rate.value)/100
var vNum1 = (values.value *1) /100
if((values.value !=0) && (rate.value ==0))
event.value = Math.round(vNum1)
if ((values.value !=0) && (rate.value !=0))
event.value = Math.round(vNum)
This is what is in the GU4454.Skidders.Rate.1 field:
var values = this.getField("GU4454.Skidders.Values.1")
var dedrate= this.getField("GU4454.Skidders.DedRate.1")
var load = this.getField("GU4454.Skidders.Load.1")
var mod= this.getField("GU4454.Skidders.Mod.1")
if (values.value !=0)
Math.floor(event.value = dedrate.value * load.value * mod.value)
if (event.value == 0)
event.value = ""
Any help with the correct syntax or where I can find help with Javascript calculations would be great. Thanks
Lisa