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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have a table with the order history =
of every=20
client.&nbsp; Each client can have as many orders or as few.&nbsp; So I =
am=20
looping through the table to create a structure for each order and then =
output=20
it.&nbsp; The problem is that I can't seem to assign the structure names =

dynamically.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I query the datasource and get all of =
the orders=20
that match the clients id.&nbsp; Then I loop through the query of orders =

found.&nbsp;&nbsp;I set a varaible to 1 and&nbsp;one is added after =
every time=20
the loop goes through.&nbsp; I try to assign the structures name to that =

number.&nbsp; It doesn't seem to work.&nbsp; Any ideas????</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Greg Wolfinger</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>here is the code:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;cfset tempCount =3D =
1&gt;<BR>&lt;cfloop=20
query=3D"qGetSalesHistory"&gt;<BR>&nbsp;&lt;cfscript&gt;<BR>&nbsp;&nbsp;t=
emp_order_id=20
=3D qGetSalesHistory.order_id;<BR>&nbsp;&nbsp;temp_ssfas =3D=20
qGetSalesHistory.ssfas;<BR>&nbsp;&nbsp;temp_odrnum =3D=20
qGetSalesHistory.odrnum;<BR>&nbsp;&nbsp;temp_rec_date =3D=20
qGetSalesHistory.rec_date;<BR>&nbsp;&nbsp;temp_due_date =3D=20
qGetSalesHistory.due_date;<BR>&nbsp;&nbsp;temp_ndy =3D=20
qGetSalesHistory.ndy;<BR>&nbsp;&nbsp;temp_total_cost =3D=20
qGetSalesHistory.total_cost;<BR>&nbsp;&nbsp;temp_rush =3D=20
qGetSalesHistory.rush;<BR>&nbsp;&nbsp;tempString =3D "order" &amp;=20
tempCount;<BR>&nbsp;&nbsp;SetVariable(tempString,=20
StructNew());<BR>&nbsp;&nbsp;StructInsert(tempString, "order_id",=20
temp_order_id);<BR>&nbsp;&nbsp;StructInsert(tempString, "ssfas",=20
temp_ssfas);<BR>&nbsp;&nbsp;StructInsert(tempString, "odrnum",=20
temp_odrnum);<BR>&nbsp;&nbsp;StructInsert(tempString, "rec_date",=20
temp_rec_date);<BR>&nbsp;&nbsp;StructInsert(tempString, "due_date",=20
temp_due_date);<BR>&nbsp;&nbsp;StructInsert(tempString, "ndy",=20
temp_ndy);<BR>&nbsp;&nbsp;StructInsert(tempString, "total_cost",=20
temp_total_cost);<BR>&nbsp;&nbsp;StructInsert(tempString, "rush",=20
temp_rush);<BR>&nbsp;&nbsp;tempCount =3D tempCount +=20
1;<BR>&nbsp;&lt;/cfscript&gt;<BR>&lt;/cfloop&gt;</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

Reply via email to