Copy link to clipboard
Copied
Hi everyone! I'm a beginner and don't know anything about writing code. I am trying to create a form for work and want the last box (Text 3.4) to show as a percentage. The formula that I want this form to calculate is [(Text 3.2 + Text 3.3)/ (Text 3.0 + Text 3.1)] * 100%. Can anyone please help me? It would be so greatly appreciated. Thank you!
I could literally cry, I am so happy. After hours of searching and learning, I figured it out! In case anyone else needs help in the future, this was the code I used 🙂 btw I changed the names so Staff1=Text3.0, Student1=Text3.1, Staff2=Text3.2, Student2=Text3.3.
var v1 = Number(this.getField("Staff1").valueAsString);
var v2 = Number(this.getField("Student1").valueAsString);
var v3 = Number(this.getField("Staff2").valueAsString);
var v4 = Number(this.getField("Student2").valueAsString);
if (v2==0) e
Copy link to clipboard
Copied
I could literally cry, I am so happy. After hours of searching and learning, I figured it out! In case anyone else needs help in the future, this was the code I used 🙂 btw I changed the names so Staff1=Text3.0, Student1=Text3.1, Staff2=Text3.2, Student2=Text3.3.
var v1 = Number(this.getField("Staff1").valueAsString);
var v2 = Number(this.getField("Student1").valueAsString);
var v3 = Number(this.getField("Staff2").valueAsString);
var v4 = Number(this.getField("Student2").valueAsString);
if (v2==0) event.value = "";
else event.value = Math.round((((v3+v4)/(v1+v2))*100));