Multiple ifs not working | Community
Skip to main content
December 20, 2024
Solved

Multiple ifs not working

  • December 20, 2024
  • 3 replies
  • 890 views

In the below module #11, I am read the request meta data.

And I am using these meta data in module # 59 (set variable) with IF statements

 

I am expecting the output of the module as "1" in the 1st operation and "2" in the 2nd operation and "3" in the 3rd operation as per the values captured in the module#11.

 

But output of the module#59 is always the first value for all operations and ignoring the subsequent values. In this example, please refer the module #59 output in the below screenshot,

 

Help me to write the correct "If statement" in the module #59

Best answer by Elanhere

I don't recommend going with if statement here. I see that you need to use tactic group and its corresponding version count in a same operation. To do that I suggest merge these both using multiple variable with any symbol say pipe (|) and then use iterator and this will generate multiple operations and then use split function to separate those values and you can use them both in a single operation. 

3 replies

_Manish_Singh
Level 9
December 20, 2024

In your case, the "or" operator will always return the first value, which is DE:Version Count 1 or 0.

For example, your formula returns 1 or 2 or 3, so the system will just take the first value because of the "or" operator.


You'll need to tweak your approach.

_Manish_Singh
Level 9
December 20, 2024

I think the best approach is to create separate variables for each tactic group, if you want to get results separately (depends on what you are trying to get).

PujaSi1Author
December 20, 2024

Thanks Manish for the response. I've stored the tactic group as separate variables but it does not resolve my problem. I think the right "multiple if" condition in the module #59 should work, any thoughts please?  

KellieGardner
Community Advisor
Community Advisor
January 2, 2025

Hi @216053 -


When doing multiple if statements you need to leave the false expression value blank otherwise, you've completed the statement and any further expressions aren't calculated.

 

In your if statement you have asked it to return a value of "DE: Version Count 1" if true and a value of "0" if False. It will not continue on after it's verified the first true/false.

 

Examples: 

Single IF Statement

IF(Condition,True Expression,False Expression)

 Multiple IF Statement

IF(Condition1,True Expression,IF(Condition2,True Expression,False Expression))

 

ElanhereAccepted solution
Level 2
January 18, 2025

I don't recommend going with if statement here. I see that you need to use tactic group and its corresponding version count in a same operation. To do that I suggest merge these both using multiple variable with any symbol say pipe (|) and then use iterator and this will generate multiple operations and then use split function to separate those values and you can use them both in a single operation. 

PujaSi1Author
January 18, 2025

thank you so much, it worked!