Skip to main content
Dec 20, 2024 7:22 AM UTC
Solved

Multiple ifs not working

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

ElanhereAccepted solution
Level 2
Jan 18, 2025 6:24 AM UTC

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. 

9 replies

_Manish_Singh
Level 9
Dec 20, 2024 7:55 AM UTC

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.

Translate
_Manish_Singh
Level 9
Dec 20, 2024 8:02 AM UTC

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).

Translate
PujaSi1Author
Dec 20, 2024 8:41 AM UTC

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?  

Translate
KellieGardner
Community Advisor
Community Advisor
Jan 2, 2025 5:09 PM UTC

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))

 

Translate
ElanhereAccepted solution
Level 2
Jan 18, 2025 6:24 AM UTC

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. 

Translate
PujaSi1Author
Jan 18, 2025 6:25 AM UTC

thank you so much, it worked!

Translate