ColdFusion 9.0 Resources |
ListLenSee alsoListAppend, ListDeleteAt, ListInsertAt, ListPrepend; Lists in the Developing ColdFusion Applications Parameters
UsageColdFusion ignores empty list elements; thus, the list "a,b,c,,,d" has four elements. Here are some examples of ListLen processing:
Example<h3>ListLen Example</h3> <!--- Find a list of users who wrote messages ---> <cfquery name = "GetMessageUser" datasource = "cfdocexamples"> SELECT Username, Subject, Posted FROMMessages </cfquery> <cfset temp = ValueList(GetMessageUser.Username)> <!--- loop through the list and show it with ListGetAt ---> <h3>This is a list of usernames who have posted messages <cfoutput>#ListLen(temp)#</cfoutput> users.</h3> <ul> <cfloop From = "1" TO = "#ListLen(temp)#" INDEX = "Counter"> <cfoutput><li>Username #Counter#: #ListGetAt(temp, Counter)#</cfoutput> </cfloop> </ul> |