I am trying to use AMPscript within an HTML email to add an HTML table or not to add the HTML table base on a data extension field that is populated or not. Then placed the %%=v(@dealership1)=%%
and %%=v(@dealerships)=%%
in the body of the HTML were I would like the table to go.
Example of my code that I have placed in my HTML script tag:
<script>
%%[
var @dealership2
var @dealership3
var @dealership1
var @dealerships
set @dealership2 = [dealer_2_name]Lookup("TEST_DATA_coupon", "dealer_2_name", "email_address", AttributeValue("emailaddr"))
set @dealership3 = [dealer_3_name]Lookup("TEST_DATA_coupon", "dealer_3_name", "email_address", AttributeValue("emailaddr"))
set @dealership1 = "<table class="dealer-infocontainer" width="210" align="left" style="width:210px;border-spacing: 0px;border: 0; margin: 0px;">
<tr style="line-height: 100%;">
<td class="dealer-icon" style="padding: 0 0 0 35px;"> Bla, BLA
</td>
</tr>
<!--<![endif]-->
</table>"
set @dealerships = "<table class="dealer-infocontainer" width="210" align="left" style="width:210px;border-spacing: 0px;border: 0; margin: 0px;">
<tr style="line-height: 100%;">
<td class="dealer-icon" style="padding: 0 0 0 35px;">
<td class="dealer-icon" style="padding: 0 0 0 35px;"> Bla, BLA
</td>
</tr>
<!--<![endif]-->
</table>"
]%%
%%[IF (@dealership2 AND @dealership3) <= 0 THEN]%%
%%=v(@dealership1)=%%
%%[ELSE]%%
%%=v(@dealership2_3)=%%
%%[ENDIF]%%
</script>