ColdFusion - Structures
#1
Anyone got any good articles (html) that I can have a look at.
I'm wanting to create something to hold a session based structure of the form:
<cfset session.cart.item=1>
<cfset session.cart.item.color=5>
<cfset session.cart.item.row=231>
etc...
But its giving me errors. I've seen examples similar to this, so I'm wondering where I'm going wrong.
Eventually I want 'color' and 'row' fields to be arrays, but first things first!
-DV
[Edited by DazV - 9/12/2002 8:56:26 PM]
I'm wanting to create something to hold a session based structure of the form:
<cfset session.cart.item=1>
<cfset session.cart.item.color=5>
<cfset session.cart.item.row=231>
etc...
But its giving me errors. I've seen examples similar to this, so I'm wondering where I'm going wrong.
Eventually I want 'color' and 'row' fields to be arrays, but first things first!
-DV
[Edited by DazV - 9/12/2002 8:56:26 PM]
#2
Seem to have things sussed now. All I need to know is how to append an array onto a structure
eg. I want:
cart.item[].qty
At the moment I have:
item[].qty
I need to know the instruction that can append
item[].qty onto the cart structure to make cart.item[].qty
[Edited by Darren (M3) - 9/13/2002 2:41:11 PM]
eg. I want:
cart.item[].qty
At the moment I have:
item[].qty
I need to know the instruction that can append
item[].qty onto the cart structure to make cart.item[].qty
[Edited by Darren (M3) - 9/13/2002 2:41:11 PM]
#6
Ok, finally managed to track something down on the net.
Stuctures within structures, arrays within structures, etc...
Out of interest, could anyone tell me how to setup this...
#cart.item[1].qty#
I did it like this but I'm not sure about the line in bold type
<!--- Step1. Define the variables --->
<CFSET var_qty=15>
<CFSET var_merchID=246>
<!--- Step2 Create a structure 'struct_item' to contain those variables --->
<CFSET struct_item=StructNew()>
<CFSET stuct_item.merchID=var_merchID>
<CFSET struct_item.qty=var_qty>
<!--- Step3 Define the array 'array_item' --->
<CFSET array_item=ArrayNew(1)>
<CFSET array_item[1]=struct_item>
<CFSET array_item[2]=struct_item>
Are those last two lines in bold correct ? I was hoping to simply replace them with one line which reads:
<CFSET array_item=struct_item>
[Edited by DazV - 9/12/2002 11:40:35 PM]
Stuctures within structures, arrays within structures, etc...
Out of interest, could anyone tell me how to setup this...
#cart.item[1].qty#
I did it like this but I'm not sure about the line in bold type
<!--- Step1. Define the variables --->
<CFSET var_qty=15>
<CFSET var_merchID=246>
<!--- Step2 Create a structure 'struct_item' to contain those variables --->
<CFSET struct_item=StructNew()>
<CFSET stuct_item.merchID=var_merchID>
<CFSET struct_item.qty=var_qty>
<!--- Step3 Define the array 'array_item' --->
<CFSET array_item=ArrayNew(1)>
<CFSET array_item[1]=struct_item>
<CFSET array_item[2]=struct_item>
Are those last two lines in bold correct ? I was hoping to simply replace them with one line which reads:
<CFSET array_item=struct_item>
[Edited by DazV - 9/12/2002 11:40:35 PM]
Thread
Thread Starter
Forum
Replies
Last Post
Doofus
Computer & Technology Related
1
18 March 2003 01:58 PM
paulwadams_my99
Drivetrain
20
23 August 2002 04:44 PM