Is there a way to round off numbers to the nearest thousand in Livecycle Designer ES?
Solved! Go to Solution.
Views
Replies
Total Likes
EVENT CALCULATE CALCULATE...
I can try something on formcalc too... though there is no difference between formcalc and javascript in your case
Here you go with formcalc:
Round((SubTotal + OtherCharge1 + OtherCharge2 + OtherCharge3)/1000)*1000
Here you go:
Javascript:
this.rawValue = Math.round(this.rawValue/1000)
this.rawValue = this.rawValue * 1000
I'd suggest you the exit or the pre-print/send event.
if you want to round down (even if the last three digits are >=500):
this.rawValue = Math.floor(this.rawValue/1000)
this.rawValue = this.rawValue * 1000
I am using FormCalc and I already have a calculate script as shown below
form1.#subform[0].Body.GrandTotal::calculate - (FormCalc, client)
SubTotal
+ OtherCharge1 + OtherCharge2 + OtherCharge3
I wrote the code below in Exit and it still shows the original value. (Changed to Javascript)
this.rawValue = Math.round(this.rawValue/1000)
this.rawValue = this.rawValue * 1000
Also tried on PrePrint, still doesn't work. Can't see 'Send' event.
Thanks.
T
Views
Replies
Total Likes
this.rawValue = SubTotal.rawValue + OtherCharge1.rawValue + OtherCharge2.rawValue + OtherCharge3.rawValue;
this.rawValue = Math.round(this.rawValue/1000);
this.rawValue = this.rawValue * 1000;
Exit it Javascript ;D
equivalent:
this.rawValue = SubTotal.rawValue + OtherCharge1.rawValue + OtherCharge2.rawValue + OtherCharge3.rawValue;
this.rawValue = Math.round(this.rawValue/1000);
this.rawValue = this.rawValue * 1000;
There's a round function in formcalc too... but forgot it... (and the semicolons ;( not my day today...)
Though... this one should work... javascript is in some functions maybe not as "fast" as formcalc... but 4 fields will be done in no time ;D
If you want it in a 1 line thing:
this.rawValue = Math.round ((SubTotal.rawValue + OtherCharge1.rawValue + OtherCharge2.rawValue + OtherCharge3.rawValue)/1000)*1000
Should work too ^^
Views
Replies
Total Likes
Thank you so much, btw will it be the same for FormCalc?
I am using FormCalc.
Tamilgodi
Views
Replies
Total Likes
EVENT CALCULATE CALCULATE...
I can try something on formcalc too... though there is no difference between formcalc and javascript in your case
Here you go with formcalc:
Round((SubTotal + OtherCharge1 + OtherCharge2 + OtherCharge3)/1000)*1000
Thanks! It works
T
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies