Friday, July 3, 2015

IList: Tags and Asset API

Mostly all output after data retrieval in FatWire and Oracle WCS is in form of IList and one needs to know how to work with IList. Hence, just simple case of how one can retrieve values using IList with tag and api.

Using TAG:

<ics:listloop list="mylist">  <ics:listget listname="mylist" fieldname="assetid" /> <ics:listget listname="mylist" fieldname="assettype" /> <ics:listget listname="mylist" fieldname="#curRow" /> //Current Row <ics:listget listname="mylist" fieldname="#numCols" /> //Number of columns <ics:listget listname="mylist" fieldname="#numRows" /> //Number of rows

//Sometimes it is required to use particular field to perfor some operation
//For eg: If you want to use asset id to pass in template
//Calling in following way will always result in same assetid
<render:calltemplate c="Type" cid='<%= ics.GetList("mylist").getValue("assetid")%>'/>

//instead use "output" attribute to save id in variable as followed:
<ics:listget listname="mylist" fieldname="assetid" output="thisId"/> <% String thisId = ics.GetVar("thisId"); %> <render:calltemplate c="Type" cid='<%= thisId%>'/>
</ics:listloop>

Users can also use this attribute while using ics:listloop tag as required - maxrows, endrow and startrow as required

Tag info: http://docs.oracle.com/cd/E29542_01/apirefs.1111/e39371/JSP/ics-listloop.html

Using Asset API:

IList iList = ics.GetList("ListName");
if(null != iList && iList.hasData()){
int numRows = iList.numRows();
String assetid = "";
String assettype = "";
    for(int currentRow=1; currentRow<=numRows; currentRow++){
             iList.moveTo(currentRow);
            assetid = iList.getValue("assetid");
             assettype = iList.getValue("assettype");
             //Do something
}
ics.RegisterList("ListName",null);
}


API info: http://docs.oracle.com/cd/E29542_01/apirefs.1111/e39356/toc.htm

Disclaimer: Any sample code on this blog is not officially recommended, use at your own risk.

2 comments:

  1. Really good blog to know aboutt basic stuff in webcenter sites

    ReplyDelete
  2. Thanks!! You can check out my other blogs and posts listed here - http://fatwiredev.blogspot.in/2013/07/all-tutorial-links.html

    ReplyDelete

A simple code compare functionality

One of the most important aspect of any development cycle is deployment and while deployment, it is very important to note the changes don...