This is a multi-part message in MIME format.
------=_NextPart_000_03C2_01C02F3E.4206BEB0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I am trying to populate an array from a query and I am running into =
problems...
>From what I have infered from the CF docs, CFQuery's are actually =
arrays.=20
If we assume that then, #QueryName[1][4]# should return the data in the =
first row and the fourth column......right??
My confusion comes from what seems to me to be conflicting info in Ben =
Forta's book and the CF online docs.=20
Ben states on page 529 (4.0) that "Database queries returned by the =
<CFQUERY> tag are actually 2D arrays..."
The online docs say that "Query column data can be referenced using =
array-like syntax. For example, myquery.col_name[1] references data in =
the first row in the column col_name."
If the latter is true then it seems to me that queries are not acutally =
true 2D arrays but "arraylike" as it says...
I have tried accessing the query as a true array but I get an error. =
Code and error are below, if anyone can clear me up on what I am missing =
I would be a very happy CF_programmer who can go home finally, becuase =
the damn project is due today and this is the last thing and it's friday =
and I have too much caffeine in me and i wont stop till I'm done!
Error Diagnostic Information
Error resolving parameter PRICEBREAKLOOP=20
ColdFusion was unable to determine the value of the parameter. This =
problem is very likely due to the fact that either:=20
1.. You have misspelled the parameter name, or=20
2.. You have not specified a QUERY attribute for a CFOUTPUT, CFMAIL, =
or CFTABLE tag.
The error occurred while evaluating the expression:=20
pricebreaks[Major_Cat][looptracker] =3D PriceBreakLoop[1][looptraker]
<cfif application.queryStatus IS 1><cfquery datasource=3D"#productdsn#" =
name=3D"PriceBreaksQuery" dbtype=3D"ODBC">SELECT *FROM =
Pricing</cfquery><cfset pricebreaks =3D ArrayNew(2)><cfloop =
query=3D"PriceBreaksQuery"><cfquery datasource=3D"#productdsn#" =
name=3D"PriceBreaksLoop" dbtype=3D"ODBC">SELECT *FROM PricingWHERE =
Major_Cat =3D '#Major_Cat#'</cfquery> <cfset looptracker =3D 0><cfloop =
query=3D"PriceBreaksLoop"><cfset looptracker =3D (looptracker + =
1)><cfset pricebreaks[Major_Cat][looptracker] =3D =
PriceBreakLoop[1][looptraker]></cfloop>
</cfloop>
jon
------=_NextPart_000_03C2_01C02F3E.4206BEB0
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.3018.900" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I am trying to populate an array from a =
query and I=20
am running into problems...</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>From what I have infered from the CF =
docs,=20
CFQuery's are actually arrays. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>If we assume that then, =
#QueryName[1][4]# should=20
return the data in the first row and the fourth =
column......right??</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>My confusion comes from what seems to =
me to be=20
conflicting info in Ben Forta's book and the CF online docs. =
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Ben states on page 529 (4.0) that =
"Database queries=20
returned by the <CFQUERY> tag are actually </FONT><FONT =
face=3DArial=20
size=3D2>2D arrays..."</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>The online docs say that "Query column =
data can be=20
referenced using array-like syntax. For example, myquery.col_name[1] =
references=20
data in the first row in the column col_name."</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>If the latter is true then it seems to =
me that=20
queries are not acutally true 2D arrays but "arraylike" as it=20
says...</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>I have tried accessing the query as a =
true array=20
but I get an error. Code and error are below, if anyone can clear =
me up on=20
what I am missing I would be a very happy CF_programmer who can go home =
finally,=20
becuase the damn project is due today and this is the last thing and =
it's friday=20
and I have too much caffeine in me and i wont stop till I'm =
done!</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>
<H4>Error Diagnostic Information</H4>
<P>Error resolving parameter <B>PRICEBREAKLOOP</B>=20
<P>
<P>ColdFusion was unable to determine the value of the parameter. This =
problem=20
is very likely due to the fact that either:=20
<OL>
<LI>You have misspelled the parameter name, or=20
<LI>You have not specified a QUERY attribute for a CFOUTPUT, CFMAIL, =
or=20
CFTABLE tag.</LI></OL>
<P>
<P>The error occurred while evaluating the expression:=20
<P><PRE> pricebreaks[Major_Cat][looptracker] =3D =
PriceBreakLoop[1][looptraker]</PRE><PRE> </PRE><PRE><FONT =
face=3DCourier><cfif application.queryStatus IS 1><BR><cfquery =
datasource=3D"#productdsn#" name=3D"PriceBreaksQuery" =
dbtype=3D"ODBC"><BR>SELECT *<BR>FROM =
Pricing<BR></cfquery><BR><cfset pricebreaks =3D =
ArrayNew(2)><BR><cfloop =
query=3D"PriceBreaksQuery"><BR><cfquery =
datasource=3D"#productdsn#" name=3D"PriceBreaksLoop" =
dbtype=3D"ODBC"><BR>SELECT *<BR>FROM Pricing<BR>WHERE Major_Cat =
=3D '#Major_Cat#'<BR></cfquery> <BR><cfset looptracker =3D =
0><BR><cfloop query=3D"PriceBreaksLoop"><BR><cfset =
looptracker =3D (looptracker + 1)><BR><cfset =
pricebreaks[Major_Cat][looptracker] =3D =
PriceBreakLoop[1][looptraker]><BR></cfloop></FONT></PRE><PRE><FO=
NT face=3DCourier></cfloop>
</FONT></PRE></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>jon</FONT></DIV>
<DIV> </DIV></BODY></HTML>
------=_NextPart_000_03C2_01C02F3E.4206BEB0--
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.