AnsweredAssumed Answered

Conditional Calculation on Conditionally Relevant Field

Question asked by JaredRyan on Jun 8, 2020
Latest reply on Jun 9, 2020 by JaredRyan

I'm wondering if I can use an "if" statement in my survey to create a conditional calculation for a Total Cost field (integer) who's calculation is dependent on {epm} = Yes versus when {epm} = No.

The condition would be something like:

            if(${epm}, 'yes') then total_cost = ${epm_cost}+ ${repair_cost}

            if(${epm}, 'no') then total_cost = ${repair_cost}

The kicker is that {epm} is only relevent when cat_a, cat_c, or cat_d (and so forth) are selected.

When Cat_B is selected, {epm} cannot be relevant

I've set the default of {epm_cost}, {repair_cost}, and {total_cost} to 0 so that the calculate is run regardless of an actual cost being entered. However, when {epm} is 'no',  {epm} is not relevant and therefore not included into the {total_cost} calculation creating a Null {total_cost}. 

 

I've attached a copy of the specific lines from my survey as well.

 

Thoughts???

Attachments

Outcomes