Webcenter Sites - How I can order a assetset list of assets by attribute value?

554 views Asked by At

I have a Asset (Modal_MKT) with a list of attributes. One of these attributes is order (int value). I want get the list of Modal_MKT elements created in WCS ordered by order field.

I let my code, this loops across all the correct modals, but final list isn't ordered by my "order" field.

<%-- 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>  

This list all assets from Modal_MKT content, but there isnt ordered by my attribute

0

There are 0 answers