Copy link to clipboard
Copied
I have a script to get the Percentage calculation, but i have to put a space before the percentage symbol as required by french translation eg. (100 %). I could not find it in the forms properties. Is there a way to get it in the script?
if (this.getField("Total").value != "") {
event.value = (this.getField("YOU SAVE").value /
this.getField("Total"). value)
}
event.value = Math.round((this.getField("YOU SAVE").value / this.getField("Total"). value)*100);
Copy link to clipboard
Copied
Try this:
var v1 = Number(this.getField("Omsetning 2018").valueAsString);
var v2 = Number(this.getField("Omsetning 2019").valueAsString);
if (v2==0) event.value = "";
else event.value = Math.round(((v2-v1)/v1)*100);
However, I think you have a mistake in your example #2. If the value in the second field is 200 and in the first it's 100 it's an increase of 100%, not 200%.
Copy link to clipboard
Copied
Thank you do much! And yes, you are of course right 🙂 100 to 200 is an increase of 100 % 🙂
Copy link to clipboard
Copied
Hi, I want to add two condition here.
1. The result appear with % sign.
2. If "YOU Save" field is empty, The field appear blank.
I know this will be very easy for you guys but I am new in this field and trying to learn stuff without technical background.
Thanks!
Copy link to clipboard
Copied
%field show only 18% not for 18.00000000% pleae anyone help me