Skip to main content
Participant
May 1, 2025
Answered

How to add calculations if a field "a" states Yes, then enter Field "b" into field "c" calculations

  • May 1, 2025
  • 1 reply
  • 509 views

I'm trying do a If, Then statement in Adobe.  I have items numbered and I have a drop-down box with "Yes" or "No" to selected.  I like to do a calculations that if Field "SplitYN1" equals "Yes" then to enter the Item number from field "Item#1#0" into antoher field "ItemSplit1".  Can someone give me step by step on what to enter and where?

Correct answer Nesa Nurani

Select 'Prepare form' tool, right click on "ItemSplit1" field and select 'Properties', then select 'Calculate' tab and as 'Custom calculation script' enter this:

var itemN = this.getField("Item#1#0").value;
var drop = this.getField("SplitYN1").valueAsString;

if(drop == "Yes")
 event.value = itemN;
else
 event.value = "";

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
May 2, 2025

Select 'Prepare form' tool, right click on "ItemSplit1" field and select 'Properties', then select 'Calculate' tab and as 'Custom calculation script' enter this:

var itemN = this.getField("Item#1#0").value;
var drop = this.getField("SplitYN1").valueAsString;

if(drop == "Yes")
 event.value = itemN;
else
 event.value = "";
Participant
May 2, 2025

Thank you, but it is still not working.  For the "Yes" and "No" question I am using a drop-down list.  Is there a different component I need to use? Such as List Box or something else?

Participant
May 2, 2025

The item number from "Item#1#0" is not showing up in field "ItemSplit1" if "SplitYN1" shows yes.