I have a page with a list element attached. How do I determine the number of items in that list? Can use render tags, asp, or any other technique (so long as it works!)
How do I determine the length of a list in RedDot/OpenText?
1k Views Asked by Bobby Jack AtThere are 4 best solutions below

<!IoRangePreExecute>
<% lst_myPagesSize = 0 %>
<!IoRangeList>
<% lst_myPagesSize = lst_myPagesSize + 1%>
<!IoRangeRedDotMode><!--[if !IE]><%lst_myPages%><![endif]--><!/IoRangeRedDotMode>
<!/IoRangeList>
<!/IoRangePreExecute>
I think this is the fastest way. First counter = 0. Then in the list range increment the counter (keep in mind to include the list place-holder too in that block). After that you have the value in the counter.

Apparently, the only way to do this is to loop through the list, counting each item, e.g.
<reddot:cms>
<foreach itemname="testList"
object="Context:CurrentPage.Elements.GetElement(lst_myPages).Value"
countername="listCounter">
</foreach>
</reddot:cms>
The length is then available as:
<%!! Store:listCounter !!%>

In OpenText use this render tag to get the length of a list (name of list element: lst_Navigation):
<%!! Context:CurrentPage.GetElementByName(lst_Navigation).GetLinkedContents().Count !!%>
Context/RDObj: by ObjectLoader Context (alias: RDObj) you get access to objects of Management Server
CurrentPage: returns Page objekt from current page
GetElementByName: method from page object to get a page element by name
GetLinkedContents: returns a LinkList object
Count: returns the number of LinkList elements
Reading the render tags documentation I believe it may be possible to do this in a nicer way
So getting the list Element using this
The Value property should return a page collection for list items so you should be able to do