0

我有一个带有属性列表的资产(Modal_MKT)。这些属性之一是 order(int 值)。我想获取在 WCS 中创建的 Modal_MKT 元素列表,按 order 字段排序。

我让我的代码循环遍历所有正确的模式,但最终列表没有按我的“订单”字段排序。

<%-- Creamos el objeto donde añadir los criterios de búsquedas --%>  
<searchstate:create name="ssModales"/>  


<%-- Si estamos en la versión móvil, sólo nos interesan las modales creadas para móvil, sino las de escritorio --%>  
<ics:if condition='<%="Touch".equalsIgnoreCase(ics.GetVar("outputdevice"))%>'>  
  <ics:then>  
  <searchstate:addsimplelikeconstraint name="ssModales" typename="Content_Attribute" attribute="showMobile" value="Si" immediateonly="true"/>  
  </ics:then>  
  <ics:else>  
  <searchstate:addsimplelikeconstraint name="ssModales" typename="Content_Attribute" attribute="showDesktop" value="Si" immediateonly="true"/>  
  </ics:else>  
</ics:if>  


<%-- Cargamos conjunto de assets de las modales del sistema --%>  
<assetset:setsearchedassets name="asModales" constraint="ssModales" assettypes="Modal_MKT" site='<%= ics.GetVar("siteId") %>'/>  


<%-- Obtenemos los valores que queramos ordenados como queramos --%>  
<assetset:getmultiplevalues name="asModales" prefix="vList" immediateonly="true" byasset="true">  
    <assetset:sortlistentry attributetypename="Content_Attribute" attributename="order" direction="descending" />  
    <assetset:sortlistentry attributetypename="Content_Attribute" attributename="modalTitle" direction="none" />  
    <assetset:sortlistentry attributetypename="Content_Attribute" attributename="modalStartDate" direction="none" />  
    <assetset:sortlistentry attributetypename="Content_Attribute" attributename="modalEndDate" direction="none" />  
    <assetset:sortlistentry attributetypename="Content_Attribute" attributename="showMobile" direction="none" />  
    <assetset:sortlistentry attributetypename="Content_Attribute" attributename="showDesktop" direction="none" />  
</assetset:getmultiplevalues>  


<%-- Pasamos el conjunto de assets a una lista y la recorremos --%>  
<assetset:getassetlist name="asModales" listvarname="aslist"/>  


<ics:listloop listname="aslist">  
    <ics:listget listname="aslist" fieldname="assetid" output="theid"/>  
    <ics:listget listname='<%="vList:"+ics.GetVar("theid")+":modalTitle"%>' fieldname="value" output="title"/>   
    <ics:listget listname='<%="vList:"+ics.GetVar("theid")+":order"%>' fieldname="value" output="order" />  
    <ics:listget listname='<%="vList:"+ics.GetVar("theid")+":modalStartDate"%>' fieldname="value" output="modalStartDate" />  
    <ics:listget listname='<%="vList:"+ics.GetVar("theid")+":modalEndDate"%>' fieldname="value" output="modalEndDate" />  
    <ics:listget listname='<%="vList:"+ics.GetVar("theid")+":showMobile"%>' fieldname="value" output="showMobile" />  
    <ics:listget listname='<%="vList:"+ics.GetVar("theid")+":showDesktop"%>' fieldname="value" output="showDesktop" />  

    <br/>  

    <%= ics.GetVar("theid") %> -   
    <%= ics.GetVar("title") %> -   
    <%= ics.GetVar("modalStartDate") %> -   
    <%= ics.GetVar("modalEndDate") %> -   
    <%= ("Si".equals(ics.GetVar("showMobile")))? "Movil:Si" : "Movil:No" %> -   
    <%= ("Si".equals(ics.GetVar("showDesktop")))? "Desktop:Si" : "Desktop:No" %> -   
    <%= (Utilities.goodString(ics.GetVar("order")))? ics.GetVar("order") : "0" %>   
</ics:listloop>  

这列出了 Modal_MKT 内容中的所有资产,但没有按我的属性排序

4

0 回答 0