House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Array question

  << Previous Post |  RSS |  Tree View |  Sort Oldest First |  Subscribe to this Group Next >> 

Array question

Use arrayClear(session.item) or just reset the array <cfset Bryan F. Hogan 05/17/2004 04:22 PM
Thank you. One more ?: How do I clear the array to start over? Robert Orlini 05/17/2004 04:12 PM
Because arrayLen(session.item) is 0 and your looping from Bryan F. Hogan 05/17/2004 03:55 PM
Why can't I get a display of the fields I'm entering with this array? When I Robert Orlini 05/17/2004 03:37 PM

05/17/2004 04:22 PM
Author: Bryan F. Hogan Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32557#163406 Use arrayClear(session.item) or just reset the array <cfset session.item=arrayNew(2)> Robert Orlini wrote: > Thank you. One more ?: How do I clear the array to start over?
05/17/2004 04:12 PM
Author: Robert Orlini Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32557#163401 Thank you. One more ?: How do I clear the array to start over? Because arrayLen(session.item) is 0 and your looping from 1-arrayLen(session.item). If your just trying to add an item to the array from a form post just use the following. <cfif not isDefined('session.item')> <cfset session.item=arrayNew(2)> </cfif> <cfset arrayLength=arrayLen(session.item)> <cfset session.item[variables.arrayLength+1][1]='qty'> <cfset session.item[variables.arrayLength+1][2]='item'> <cfset session.item[variables.arrayLength+1][3]='price'> <cfoutput>#arrayLen(session.item)#</cfoutput> <cfdump var="#session.item#">   _____  
05/17/2004 03:55 PM
Author: Bryan F. Hogan Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32557#163397 Because arrayLen(session.item) is 0 and your looping from 1-arrayLen(session.item). If your just trying to add an item to the array from a form post just use the following. <cfif not isDefined('session.item')>   <cfset session.item=arrayNew(2)> </cfif> <cfset arrayLength=arrayLen(session.item)> <cfset session.item[variables.arrayLength+1][1]='qty'> <cfset session.item[variables.arrayLength+1][2]='item'> <cfset session.item[variables.arrayLength+1][3]='price'> <cfoutput>#arrayLen(session.item)#</cfoutput> <cfdump var="#session.item#">
05/17/2004 03:37 PM
Author: Robert Orlini Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32557#163393 Why can't I get a display of the fields I'm entering with this array? When I cfoutput the #arraylen(session.item)#  its always 0 (zero). <CFIF Not IsDefined("Session.item")> <CFSET session.item = arraynew(2)> </CFIF> <CFIF isDefined("form.more.x")> <CFSET itemcount = arraylen(session.item)> #arraylen(session.item)# <CFLOOP from="1" to="#arraylen(session.item)#" index="i" step="1"> <CFSET Session.item[itemcount+1][1]=form.qty> <CFSET Session.item[itemcount+1][2]=form.item> <CFSET Session.item[itemcount+1][3]=form.priceeach> #session.item[i][1]#<br> #session.item[i][2]#<br> #session.item[i][3]#<br> </cfloop> </cfif> </CFOUTPUT> Robert Orlini HW Wilson 718-588-8400 x2656 ô¿ô
<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 24, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
     1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31     

Designer, Developer and mobile workflow conference