I recommend Assigning those orders into an array, or query variable
-----Original Message-----
From: Greg Wolfinger [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 20, 2000 10:33 PM
To: CF-Talk
Subject: Structures
This is a multi-part message in MIME format.
------=_NextPart_000_0007_01C0534A.27ECF5A0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hey Guys:
I have a table with the order history of every client. Each client can =
have as many orders or as few. So I am looping through the table to =
create a structure for each order and then output it. The problem is =
that I can't seem to assign the structure names dynamically.
I query the datasource and get all of the orders that match the clients =
id. Then I loop through the query of orders found. I set a varaible to =
1 and one is added after every time the loop goes through. I try to =
assign the structures name to that number. It doesn't seem to work. =
Any ideas????
Thanks,
Greg Wolfinger
here is the code:
<cfset tempCount =3D 1>
<cfloop query=3D"qGetSalesHistory">
<cfscript>
temp_order_id =3D qGetSalesHistory.order_id;
temp_ssfas =3D qGetSalesHistory.ssfas;
temp_odrnum =3D qGetSalesHistory.odrnum;
temp_rec_date =3D qGetSalesHistory.rec_date;
temp_due_date =3D qGetSalesHistory.due_date;
temp_ndy =3D qGetSalesHistory.ndy;
temp_total_cost =3D qGetSalesHistory.total_cost;
temp_rush =3D qGetSalesHistory.rush;
tempString =3D "order" & tempCount;
SetVariable(tempString, StructNew());
StructInsert(tempString, "order_id", temp_order_id);
StructInsert(tempString, "ssfas", temp_ssfas);
StructInsert(tempString, "odrnum", temp_odrnum);
StructInsert(tempString, "rec_date", temp_rec_date);
StructInsert(tempString, "due_date", temp_due_date);
StructInsert(tempString, "ndy", temp_ndy);
StructInsert(tempString, "total_cost", temp_total_cost);
StructInsert(tempString, "rush", temp_rush);
tempCount =3D tempCount + 1;
</cfscript>
</cfloop>
------=_NextPart_000_0007_01C0534A.27ECF5A0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hey Guys:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>I have a table with the order history =
of every=20
client. Each client can have as many orders or as few. So I =
am=20
looping through the table to create a structure for each order and then =
output=20
it. The problem is that I can't seem to assign the structure names =
dynamically.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>I query the datasource and get all of =
the orders=20
that match the clients id. Then I loop through the query of orders =
found. I set a varaible to 1 and one is added after =
every time=20
the loop goes through. I try to assign the structures name to that =
number. It doesn't seem to work. Any ideas????</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Greg Wolfinger</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>here is the code:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><cfset tempCount =3D =
1><BR><cfloop=20
query=3D"qGetSalesHistory"><BR> <cfscript><BR> t=
emp_order_id=20
=3D qGetSalesHistory.order_id;<BR> temp_ssfas =3D=20
qGetSalesHistory.ssfas;<BR> temp_odrnum =3D=20
qGetSalesHistory.odrnum;<BR> temp_rec_date =3D=20
qGetSalesHistory.rec_date;<BR> temp_due_date =3D=20
qGetSalesHistory.due_date;<BR> temp_ndy =3D=20
qGetSalesHistory.ndy;<BR> temp_total_cost =3D=20
qGetSalesHistory.total_cost;<BR> temp_rush =3D=20
qGetSalesHistory.rush;<BR> tempString =3D "order" &=20
tempCount;<BR> SetVariable(tempString,=20
StructNew());<BR> StructInsert(tempString, "order_id",=20
temp_order_id);<BR> StructInsert(tempString, "ssfas",=20
temp_ssfas);<BR> StructInsert(tempString, "odrnum",=20
temp_odrnum);<BR> StructInsert(tempString, "rec_date",=20
temp_rec_date);<BR> StructInsert(tempString, "due_date",=20
temp_due_date);<BR> StructInsert(tempString, "ndy",=20
temp_ndy);<BR> StructInsert(tempString, "total_cost",=20
temp_total_cost);<BR> StructInsert(tempString, "rush",=20
temp_rush);<BR> tempCount =3D tempCount +=20
1;<BR> </cfscript><BR></cfloop></FONT></DIV></BODY></HTM=
L>
------=_NextPart_000_0007_01C0534A.27ECF5A0--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists