Select to view content in your preferred language

How to have two formulas in one field and use any depending on response of a previous selection question?

905
2
Jump to solution
01-04-2023 01:00 PM
Vaneiri_Patt
Emerging Contributor

I am trying to develop my syntax to have two formulas in one field and based on a previous question, either or would be used to carry out the calculation.

For example:

1. Type of Meter

  • With CT
  • Without CT

2. kw calculation 

I have these two formulas that I would want to use depending on response on #1.

round((3.6*21.6)div${seconds1},1) applicable only if Without CT was selected

round((3.6*1.8*${factor})div${seconds1},1) applicable only if With CT was selected

How can I setup these two formulas in one field and based on type of meter selected previously that it would proceed to calculate. 

0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Esteemed Contributor

if(${ctfield} = 'Without CT' and ${ctfield} != '', round((3.6*21.6)div${seconds1},1), round((3.6*1.8*${factor})div${seconds1},1) )

I added the check for blank.  But this assumes there is only 2 options.  If there are more you could do this so that it does nothing if it is any other choice.

if(${ctfield} = 'With CT', round((3.6*21.6)div${seconds1},1), if(${ctfield} = 'Without CT', round((3.6*1.8*${factor})div${seconds1},1) , ''))

hope that helps

View solution in original post

0 Kudos
2 Replies
DougBrowning
MVP Esteemed Contributor

if(${ctfield} = 'Without CT' and ${ctfield} != '', round((3.6*21.6)div${seconds1},1), round((3.6*1.8*${factor})div${seconds1},1) )

I added the check for blank.  But this assumes there is only 2 options.  If there are more you could do this so that it does nothing if it is any other choice.

if(${ctfield} = 'With CT', round((3.6*21.6)div${seconds1},1), if(${ctfield} = 'Without CT', round((3.6*1.8*${factor})div${seconds1},1) , ''))

hope that helps

0 Kudos
Vaneiri_Patt
Emerging Contributor

Yes it did @DougBrowning.

Thank you so much!