• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

If/Else Script with a Yes/No Condition

New Here ,
Jun 30, 2024 Jun 30, 2024

Copy link to clipboard

Copied

I am trying to create a custom calculation that says...

If TotalExpense < or = DiscretionaryIncome then Seed Funding Text Field Shows "No"

 

If TotalExpense > DiscretionaryIncome then Seed Funding Text Field Shows "Yes"

 

Can anyone help me with this code?

Have anyone written anything like this before?

TOPICS
JavaScript , PDF forms

Views

209

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 30, 2024 Jun 30, 2024

Use this as custom calculation script of "Seed Funding" field:

var Texpense = this.getField("TotalExpense").valueAsString;
var Dincome = this.getField("DiscretionaryIncome").valueAsString;

if(Texpense === "" || Dincome === "") {
 event.value = "";} 
else {
 Texpense = Number(Texpense);
 Dincome = Number(Dincome);
 
if(Texpense <= Dincome)
 event.value = "No";
else if(Texpense > Dincome)
 event.value = "Yes";}

Votes

Translate

Translate
Community Expert ,
Jun 30, 2024 Jun 30, 2024

Copy link to clipboard

Copied

Use this as custom calculation script of "Seed Funding" field:

var Texpense = this.getField("TotalExpense").valueAsString;
var Dincome = this.getField("DiscretionaryIncome").valueAsString;

if(Texpense === "" || Dincome === "") {
 event.value = "";} 
else {
 Texpense = Number(Texpense);
 Dincome = Number(Dincome);
 
if(Texpense <= Dincome)
 event.value = "No";
else if(Texpense > Dincome)
 event.value = "Yes";}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 30, 2024 Jun 30, 2024

Copy link to clipboard

Copied

LATEST

Thank you, Nesa. It worked like a charm! 
I appreciate the help!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines