我在电子邮件中有以下RPL代码:
<#data ALERTS as alerts>
<#filter USER_ID1=CONTACTS_LIST.CUSTOMER_ID_1>
<#fields AD_ID_LIST1>
<#assign cellCount = 0>
<#list alerts.AD_ID_LIST1?split(r'\s*,\s*', 'r') as idString>
<#data AD_TABLE as adtable>
<#filter AD_ID="${idString}">
<#fields AD_ID TITLE IMAGES DESCRIPTION PRICE_AMOUNT PRICE_TYPE CATEGORY_ID1 AD_STATE>
<#if idstring?? && adtable.AD_STATE='ACTIVE'>
<#assign cellCount = cellCount + 1>
<#if cellCount % 2 == 1 && idString_has_next == false>
<!-- INCLUDE SINGLE -->
<#elseif cellCount % 2 == 1 && idString_has_next == true>
<!-- Include LEFT -->
<#else>
<!-- INCLUDE RIGHT -->
</#if>
</#if></#data></#list></#data>
我需要做的是,在确定没有要显示的广告ID之后,如果cellCount = 0,则将电子邮件跳过发送给用户(状态是否未激活或者是否已从表中删除。
有谁知道怎么做?
答案 0 :(得分:0)
你可以使用skip指令,例如:
public class RuleConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return typeof(Rule).IsAssignableFrom(objectType);
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
var jo = JObject.Load(reader);
Rule rule = null;
if (jo["condition"] == null)
{
rule = new Rule();
}
else
{
rule = new Condition();
}
serializer.Populate(jo.CreateReader(), rule);
return rule;
}
public override bool CanWrite
{
get { return false; }
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new NotImplementedException();
}
}