– Common Function Library Project

CreateOrderedList(st, end[, step][, delim])

Last updated September 28, 2006


Mike Gillespie

Version: 1 | Requires: CF5 | Library: UtilityLib

Pass in Start and End numbers (with options for delim and step increment) and this UDF will generate an Ascending (or descending), ordered delimited list in your step increment.

Return Values:
Returns a string.


Basic: #CreateOrderedList(1,10)#<br>
Step Down: #createOrderedList(0,-25,5,"|")#


Name Description Required
st Start number. Yes
end End number. Yes
step Step value. Defaults to 1. No
delim List delimiter. Defaults to a comma. No

Full UDF Source:

 * Used to create an Ordered Numeric List
 * v2 mods by Raymond Camden
 * @param st      Start number. (Required)
 * @param end      End number. (Required)
 * @param step      Step value. Defaults to 1. (Optional)
 * @param delim      List delimiter. Defaults to a comma. (Optional)
 * @return Returns a string. 
 * @author Mike Gillespie ( 
 * @version 1, September 28, 2006 
function createOrderedList(st,end) {
    var theList="";
    var delim=",";
    var step=1;

    // 3rd argument sets the step increment
    if(arraylen(arguments) gte 3) step=arguments[3];

    //4th argument sets the delim
    if(arraylen(arguments) eq 4) delim=arguments[4];

    if(st gte end) for(i = st;i gte end;i=i-step) theList=listappend(theList,i,delim);        
    else for(i = st;i lte end;i=i+step) theList=listappend(theList,i,delim);        

    return theList;


Latest Additions

Raymond Camden added
November 04, 2017

Leigh added
May 11, 2016

Raymond Camden added
May 10, 2016

Kevin Cotton added
May 05, 2016

Raymond Camden added
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson