Copy link to clipboard
Copied
Im new to using Adobe DC and API's so please bear with me .
Im looking for a way to populate differnet form fields based on calculation results.
If (Text18 - Text19 - Text20) > 0 then report on Text21
If (Text18 - Text19 - Text20) = 0 then report on Text21 & Text22
Please see reference below:
thank you for your time
Try this code as 'calculation' script of "Text22" field:
var t18 = Number(this.getField("Text18").value);
var t19 = Number(this.getField("Text19").value);
var t20 = Number(this.getField("Text20").value);
var t21 = this.getField("Text21");
var tot = t18-t19-t20;
if(t18 == "" && t19 == "" && t20 == ""){
event.value = "";
t21.value = "";}
else if(tot > 0){
event.value = "";
t21.value = tot;}
else if(tot < 0){
event.value = Math.abs(tot);
t21.value = "";}
else if (tot == 0){
event.value = tot;
t21.value = tot;}
Copy link to clipboard
Copied
Hi CMunro
Hope you are doing well and sorry for the trouble.
The workflow that you are trying to achieve is possible using the JavaScript. For more information please check out the help page: https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/js_developer_guide.pdf and see if that works for you.
Regards
Amal
Copy link to clipboard
Copied
Try this code as 'calculation' script of "Text22" field:
var t18 = Number(this.getField("Text18").value);
var t19 = Number(this.getField("Text19").value);
var t20 = Number(this.getField("Text20").value);
var t21 = this.getField("Text21");
var tot = t18-t19-t20;
if(t18 == "" && t19 == "" && t20 == ""){
event.value = "";
t21.value = "";}
else if(tot > 0){
event.value = "";
t21.value = tot;}
else if(tot < 0){
event.value = Math.abs(tot);
t21.value = "";}
else if (tot == 0){
event.value = tot;
t21.value = tot;}
Copy link to clipboard
Copied
Nesa, thank you very much for your help . The script you gave me worked like a charm!! 🙂