Hi,

I'm trying to create a cffunction where I can dynamically loop between to points of an array. For example I may want to be able to loop from point 1 of the array to point 10. Then I may want to loop from point 11 to point 20 of the same array.

I've written a function to do this, which looks like this:

<cffunction name="arrayPositionValues" access="public" returntype="any"
                description="I take in 2 numbers and find the values in the columnListArr">
        <cfargument name="startPoint" type="numeric" required="false" />
        <cfargument name="endPoint" type="numeric" required="false" />           

        <cfset MyNewArray = ArrayNew(1)>
        <cfloop index="x" from="#ArrayLen(variables.columnListArr[startPoint])#" to="#ArrayLen(variables.columnListArr[endPoint])#">
            <!--- build array --->
            <cfset #ArrayAppend(MyNewArray, x)#>
        </cfloop>
       
        <!--- return sub section of array --->
        <cfreturn MyNewArray />
       
    </cffunction>

In this I am creating a sub section of a larger array based on the two points being passed into the function. Unfortunately I can't seem to get the loop to loop between the two points that I'm passing in.

Can anyone suggest a better way to do this?

Thanks

Stephen
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]

Reply via email to