0

我在这里有一个 ampscript 代码,它显示了所有具有值的字段。如果没有值,它应该显示“N/A”作为它的值,对于有值的字段,它应该是可点击的,如果该字段没有值,它应该显示“N/A”值它不应该是可点击的。但就我而言,即使它具有正确的值或只是 N/A,它仍然是可点击的。还有其他选项可以使 N/A 无法点击吗?这是输出:

样品照片

这是 Ampscript 代码:

   %%[
VAR @BDM, @CDBP, @CSN, @CSO, @CS1, @CS2, @CS3, @CS4

 IF EMPTY(BDM_Email)
    THEN SET @BDM = "N/A"
    THEN SET @CS1 = "BDM"
  ELSE SET @BDM = BDM_Email
    SET @CS1 = "BDM"
 ENDIF

 IF EMPTY(CDBP_Email)
    THEN SET @CDBP = "N/A"
    THEN SET @CS2 = "CDBP"
  ELSE SET @CDBP = CDBP_Email
    SET @CS2 = "CD BP"
 ENDIF

 IF EMPTY(CSN_Email)
    THEN SET @CSN = "N/A"
    THEN SET @CS3 = "Customer Service"
  ELSE SET @CSN = CSN_Email
    SET @CS3 = "Customer Service"
 ENDIF
 
  IF EMPTY(CSO_Email)
    THEN SET @CSO = "N/A"
    THEN SET @CS4 = "CD Ops"
  ELSE SET @CSO = CSO_Email
    SET @CS4 = "CD Ops"
 
ENDIF ]%%

对于 HTML: <div style="line-height: 150%;"> <span style="font-family:Arial,Helvetica,sans-serif;"><b><span style="color:#000000;"> <span style="font-size:24px;">Your Team</span></span></b></span></div><div style="line-height: 150%;"> <span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:11px;">Looking for something specific? We are here for you!</span></span><p style="line-height: 100%;"> <span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:11px;">%%=v(@CS1)=%%</span><br> <span style="font-size:11px;"><a href="mailto:data-amp-placeholder-2-amp-end">%%=v(@BDM)=%%</a></span></span></p><p style="line-height: 100%;"> <span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:11px;">%%=v(@CS2)=%%</span><br> <span style="font-size:11px;"><a href="mailto:data-amp-placeholder-5-amp-end">%%=v(@CDBP)=%%</a>&nbsp;</span></span></p><p style="line-height: 100%;"> <span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:11px;">%%=v(@CS3)=%%</span><br> <span style="font-size:11px;"><a href="mailto:data-amp-placeholder-8-amp-end">%%=v(@CD_OPS)=%%</a></span></span></p><p style="line-height: 100%;"> <span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:11px;">%%=v(@CS4)=%%</span><br> <span style="font-size:11px;"><a href="mailto:data-amp-placeholder-11-amp-end">%%=v(@CSO)=%%</a></span></span></p></div>

4

1 回答 1

0

最简单的方法是在 HTML 中使用 AMPscript,方法是将其包装在 IF/THEN 语句中。

例如:

<p style="line-height: 100%;font-family:Arial,Helvetica,sans-serif;font-size:11px;">
BDM <br> 
%%[IF EMPTY(BDM_Email) then]%%
  N/A
%%[else then]%%
  <a href="mailto:data-amp-placeholder-2-amp-end">BDM_Email</a> 
%%[endif]%%
</p>

于 2021-09-29T15:05:43.790 回答