0

I'm building an eDM campaign for a retailer and I need to create dynamic content that will display content differently for 5 different users.

I have these columns within the DE:

Gender: Female or Male -

Preference_Female: True, False or EMPTY() - Those who want to see female products

Preference_Male: True, False or EMPTY() - Those who want to see male products


The result I'm trying to achieve is to put our users into these filters of content,

1 - display x if they have a preference for female products.

2 - display x if they select female gender and don't have a preference for either male or female products or they want both.

3 - display x if they have a preference for male products.

4 - display x if they select male gender and don't have a preference for either male or female products or they want both.

5 - everything else

Note: We have empty(), transgender and non-binary options for gender so we don't send them targeted gender emails.


Here is the code I've built so far, does it look correct?

Because for some reason those who have preference_male = true, prefence_female = true and have a gender = 'F' or 'M' they receive two filters

:

%%[IF (PREFERENCE_FEMALE == 'TRUE' AND PREFERENCE_MALE == 'FALSE') THEN]%%
<table width="100%">
<tr>
<td align="center" style="text-align:center" width="100%"><strong>Female only preference</strong></td>
</tr>
</table>
%%[ENDIF]%% %%[IF (PREFERENCE_FEMALE == 'TRUE' AND PREFERENCE_MALE == 'TRUE' AND GENDER == 'F') OR EMPTY(PREFERENCE_FEMALE) AND EMPTY(PREFERENCE_MALE) AND GENDER == 'F' THEN]%%
<table width="100%">
<tr>
<td align="center" style="text-align:center" width="100%"><strong>No or both preference but gender is female</strong></td>
</tr>
</table>
%%[ENDIF]%% %%[IF (PREFERENCE_MALE == 'TRUE' AND PREFERENCE_FEMALE == 'FALSE') THEN]%%
<table width="100%">
<tr>
<td align="center" style="text-align:center" width="100%"><strong>Male only preference</strong></td>
</tr>
</table>
%%[ENDIF]%% %%[IF (PREFERENCE_FEMALE == 'TRUE' AND PREFERENCE_MALE == 'TRUE' AND GENDER == 'M') OR EMPTY(PREFERENCE_FEMALE) AND EMPTY(PREFERENCE_MALE) AND GENDER == 'M' THEN]%%
<table width="100%">
<tr>
<td align="center" style="text-align:center" width="100%"><strong>No or both preference but gender is male</strong></td>
</tr>
</table>
%%[ENDIF]%% %%[ELSE THEN]%%
<table width="100%">
<tr>
<td align="center" style="text-align:center" width="100%"><strong>Everything else</strong></td>
</tr>
</table>
%%[ENDIF]%%
  • What have you done to test this yourself? You're asking, "Here is the code I've built so far, does it look correct?", but you're not saying if you've run into a problem. – Harley May 29 '18 at 17:38
  • Hey Harley, Testing using dummy list based off the real DE (as in they have all the same data colomns). I explained my problem in the next sentence: "Because for some reason those who have preference_male = true, prefence_female = true and have a gender = 'F' or 'M' they receive two filters." Cheers – D.Charles May 31 '18 at 6:13
0

The below works for me. You may be getting two filters because you're using IF statements on top of each other instead of ELSEIF. The screenshot is my interpretation of what values would appear in your DE.

%%[IF(PREFERENCE_FEMALE == 'TRUE' AND PREFERENCE_MALE != 'TRUE') 
THEN]%% <p>display x if they have a preference for female products. 
<br>Gender = %%GENDER%%<br>Preference Female Value = 
%%PREFERENCE_FEMALE%%<br> Preference Male Value = %%PREFERENCE_MALE%%</p>

%%[ELSEIF (GENDER == 'F' AND EMPTY(PREFERENCE_FEMALE) AND 
EMPTY(PREFERENCE_MALE)) THEN]%% <p>display x if they select female 
gender and don't have a preference for either male or female products 
or they want both.<br>Gender = %%GENDER%%<br><br>Preference Female = 
%%PREFERENCE_FEMALE%%<br> Preference Male Value = %%PREFERENCE_MALE%%</p>

%%[ELSEIF (PREFERENCE_FEMALE != 'TRUE' AND PREFERENCE_MALE == 'TRUE') 
THEN]%% <p>display x if they have a preference for male products. 
<br>Gender = %%GENDER%%<br><br>Preference Female Value = 
%%PREFERENCE_FEMALE%%<br> Preference Male Value = %%PREFERENCE_MALE%%</p>

%%[ELSEIF (GENDER == 'M' AND EMPTY(PREFERENCE_FEMALE) AND 
EMPTY(PREFERENCE_MALE)) THEN]%% <p>display x if they select male gender 
and don't have a preference for either male or female products or they 
want both.<br>Gender = %%GENDER%%<br><br>Preference Female Value = 
%%PREFERENCE_FEMALE%%<br> Preference Male Value = %%PREFERENCE_MALE%%</p>

%%[ELSE]%%
<p>everything else<br>Gender = %%GENDER%%<br><br>Preference Female 
Value = %%PREFERENCE_FEMALE%%<br> Preference Male Value = 
%%PREFERENCE_MALE%%</p>

%%[ENDIF]%%

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.