TomRed.net

  • Increase font size
  • Default font size
  • Decrease font size
Subscribe Bookmark and Share
Home Tutorials Java FatWire Iterate a List

FatWire Iterate a List

User Rating: / 0
PoorBest 

The initial part of this example is simply retrieving a list of titles from an asset of type myAsset. This list of titles are passed into a variable of called listTitles using the listvarname attribute of the assetset:getattributevalues FatWire tag.

This list is then iterated through using the ics:listloop tag by passing the var name listTitles into the listname attribute.  This tag will step through each item in the list with can then be accessed in the loop using ics:listget tag.   ics:listget allows access to the current item in the loop and we can access any fieldname associated with that type.  Fieldname refers to the attributes of the asset you are looping through. 

In the example below we want the value of the associated title and we are assigning this value to a variable called title. We can finally use the ics.GetVar("") Java method to access a FatWire specific variable. In this case the value is output to the browser.

	<assetset:setasset name="objAsset" type="myAsset" id='<%=ics.GetVar("cid") %>' />
<assetset:getattributevalues name="objAsset" attribute="Title" listvarname="listTitles" typename="myAttribute" />

<ics:listloop listname="listTitles">

	<ics:listget listname="listTitles" fieldname="value" output="title" />
	<%=ics.GetVar("title")%>

</ics:listloop>