If I use CFLOOP -- do I just keep appending to the string I am creating ...
Ie.,
<CFLOOP query="getcategory">
<CFSET myvar = myvar & "Category " & getcategory.currentrow &
getcategory.title>
</CFLOOP>
...or is there a more efficient append function to use with the variable?
Thanks for the help!
>
>
> Use CFLOOP instead of CFOUTPUT combined with your CFFILE operation. Keep
in
> mind that the currentrow variable will be determined as an incrementing
> number from 1 to recordcount, and is only indicative of the physical order
> in which the query was returned to CF based on your SQL statement.
>
> DC
>
> -----Original Message-----
> From: PC [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 20, 2000 14:40
> To: [EMAIL PROTECTED]
> Subject: Re: Current Row in SQL as opposed to CF? [CF-Talk]
>
>
> I am using SQL Server 7.
>
> I can use CFOUTPUT I suppose. What I need to do is set the results to a
> variable and write that as part of a file.
>
> I am a little unclear on how I would even use CFOUTPUT in this
fashion --
> can I somehow
> set the output to a variable?
>
> <CFOUTPUT query="getcategories">
> "Category" #currentrow# #Category_Title#
> </cfoutput>
>
> I need this in a variable that is part of a few variables concatenated
and
> written to a file using CFFILE write ....
>
> Thanks for anymore insight... :)
>
>
>
>
> > Not in standard SQL. This operation would be at odds with
> > the relational view of data, in which data is intrinsically
> > not ordered.
> >
> > So if there is a way of doing it that would work in a single
> > CFQUERY, it's going to be be DBMS-specific. If you happen
> > to be using PostgreSQL you might be able to to create a
> > user-defined function in 'C' to do it, but that would be
> > crazy.
> >
> > But if you can't use CFOUTPUT, why does it matter what the
> > results look like? What exactly are you trying to do?
> >
> > Nick
> >
> > -----Original Message-----
> > From: PC [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, September 20, 2000 2:07 PM
> > To: [EMAIL PROTECTED]
> > Subject: Current Row in SQL as opposed to CF? [CF-Talk]
> >
> >
> > IS there a way to do get the current row as part of a select statement
> in
> a
> > similar fashion as the coldfusion #queryname.currentrow# property
> functions
> > in a CFOUTPUT context?
> >
> > What I need are results that look like:
> >
> > Category 1 Sports
> > Category 2 Languages
> > Category 3 Reference
> > Category 4 Politics
> >
> > from a query looking something like:
> >
> > SELECT TOP 4 Category + ?currentrow? + Category_title
> >
> > So what property exists, or technique for generating the ?currentrow?
> part
> > of the statement above????
> >
> > Now, I cannot use the indentity field .. I don't want values like
> > Category 2 ...
> > Category 19 ...
> >
> > And ... I cannot use a CFOUTPUT or CFLOOP -- I want to do it all in
the
> SQL
> > statement if possible!!
> >
> >
>
>
>
> --------------------------------------------------------------------------
> --
> > --
> > 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.
> >
> >
> > **********************************************************************
> > Information in this email is confidential and may be privileged.
> > It is intended for the addressee only. If you have received it in
error,
> > please notify the sender immediately and delete it from your system.
> > You should not otherwise copy it, retransmit it or use or disclose its
> > contents to anyone.
> > Thank you for your co-operation.
> > **********************************************************************
>
>
>
> --------------------------------------------------------------------------
> ----
> > 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.
> >
>
> ------------------------------------------------------------------------
--
> ----
> 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.
>
>
> ------=_NextPart_000_01B0_01C02310.14845680
> 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><TITLE>Re: Current Row in SQL as opposed to CF? =
> [CF-Talk]</TITLE>
> <META content=3D"text/html; charset=3Diso-8859-1" =
> http-equiv=3DContent-Type>
> <META content=3D"MSHTML 5.00.3018.900" name=3DGENERATOR></HEAD>
> <BODY>
> <DIV> </DIV>
> <DIV> </DIV>
> <DIV> </DIV>
> <DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN =
> class=3D516313414-20092000>Use=20
> CFLOOP instead of CFOUTPUT combined with your CFFILE operation. =
> Keep in=20
> mind that the currentrow variable will be determined as an incrementing =
> number=20
> from 1 to recordcount, and is only indicative of the physical order in =
> which the=20
> query was returned to CF based on your SQL =
> statement.</SPAN></FONT></DIV>
> <DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
> class=3D516313414-20092000></SPAN></FONT> </DIV>
> <DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
> class=3D516313414-20092000>DC</SPAN></FONT></DIV>
> <DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
> class=3D516313414-20092000></SPAN></FONT> </DIV>
> <BLOCKQUOTE style=3D"MARGIN-RIGHT: 0px">
> <DIV align=3Dleft class=3DOutlookMessageHeader dir=3Dltr><FONT =
> face=3DTahoma=20
> size=3D2>-----Original Message-----<BR><B>From:</B> PC=20
> [mailto:[EMAIL PROTECTED]]<BR><B>Sent:</B> Wednesday, September 20, 2000=20
> 14:40<BR><B>To:</B> [EMAIL PROTECTED]<BR><B>Subject:</B> Re: =
> Current=20
> Row in SQL as opposed to CF? [CF-Talk]<BR><BR></DIV></FONT>
> <P><FONT size=3D2>I am using SQL Server 7.</FONT> </P>
> <P><FONT size=3D2>I can use CFOUTPUT I suppose. What I need to do is =
> set the=20
> results to a</FONT> <BR><FONT size=3D2>variable and write that as part =
> of a=20
> file.</FONT> </P>
> <P><FONT size=3D2>I am a little unclear on how I would even use =
> CFOUTPUT in this=20
> fashion --</FONT> <BR><FONT size=3D2>can I somehow</FONT> <BR><FONT =
> size=3D2>set=20
> the output to a variable?</FONT> </P>
> <P><FONT size=3D2><CFOUTPUT query=3D"getcategories"></FONT> =
> <BR><FONT=20
> size=3D2>"Category" #currentrow# #Category_Title#</FONT> =
> <BR><FONT=20
> size=3D2></cfoutput></FONT> </P>
> <P><FONT size=3D2>I need this in a variable that is part of a few =
> variables=20
> concatenated and</FONT> <BR><FONT size=3D2>written to a file using =
> CFFILE write=20
> ....</FONT> </P>
> <P><FONT size=3D2>Thanks for anymore insight... :)</FONT> </P><BR><BR>
> <P><FONT size=3D2>> Not in standard SQL. This operation would be at =
> odds=20
> with</FONT> <BR><FONT size=3D2>> the relational view of data, in =
> which data=20
> is intrinsically</FONT> <BR><FONT size=3D2>> not ordered.</FONT> =
> <BR><FONT=20
> size=3D2>></FONT> <BR><FONT size=3D2>> So if there is a way of =
> doing it that=20
> would work in a single</FONT> <BR><FONT size=3D2>> CFQUERY, it's =
> going to be=20
> be DBMS-specific. If you happen</FONT> <BR><FONT size=3D2>> to be =
> using=20
> PostgreSQL you might be able to to create a</FONT> <BR><FONT =
> size=3D2>>=20
> user-defined function in 'C' to do it, but that would be</FONT> =
> <BR><FONT=20
> size=3D2>> crazy.</FONT> <BR><FONT size=3D2>></FONT> <BR><FONT =
> size=3D2>>=20
> But if you can't use CFOUTPUT, why does it matter what the</FONT> =
> <BR><FONT=20
> size=3D2>> results look like? What exactly are you trying to =
> do?</FONT>=20
> <BR><FONT size=3D2>></FONT> <BR><FONT size=3D2>> Nick</FONT> =
> <BR><FONT=20
> size=3D2>></FONT> <BR><FONT size=3D2>> -----Original =
> Message-----</FONT>=20
> <BR><FONT size=3D2>> From: PC [<A=20
> href=3D"mailto:[EMAIL PROTECTED]">mailto:[EMAIL PROTECTED]</A>]</FONT> =
> <BR><FONT=20
> size=3D2>> Sent: Wednesday, September 20, 2000 2:07 PM</FONT> =
> <BR><FONT=20
> size=3D2>> To: [EMAIL PROTECTED]</FONT> <BR><FONT =
> size=3D2>>=20
> Subject: Current Row in SQL as opposed to CF? [CF-Talk]</FONT> =
> <BR><FONT=20
> size=3D2>></FONT> <BR><FONT size=3D2>></FONT> <BR><FONT =
> size=3D2>> IS there=20
> a way to do get the current row as part of a select statement =
> in</FONT>=20
> <BR><FONT size=3D2>a</FONT> <BR><FONT size=3D2>> similar fashion as =
> the=20
> coldfusion #queryname.currentrow# property</FONT> <BR><FONT=20
> size=3D2>functions</FONT> <BR><FONT size=3D2>> in a CFOUTPUT =
> context?</FONT>=20
> <BR><FONT size=3D2>></FONT> <BR><FONT size=3D2>> What I need are =
> results=20
> that look like:</FONT> <BR><FONT size=3D2>></FONT> <BR><FONT =
> size=3D2>>=20
> Category 1 Sports</FONT> <BR><FONT size=3D2>>=20
> Category 2 Languages</FONT> <BR><FONT size=3D2>>=20
> Category 3 Reference</FONT> <BR><FONT size=3D2>>=20
> Category 4 Politics</FONT> <BR><FONT =
> size=3D2>></FONT>=20
> <BR><FONT size=3D2>> from a query looking something like:</FONT> =
> <BR><FONT=20
> size=3D2>></FONT> <BR><FONT size=3D2>> SELECT TOP 4 Category + =
> ?currentrow?=20
> + Category_title</FONT> <BR><FONT size=3D2>></FONT> <BR><FONT =
> size=3D2>> So=20
> what property exists, or technique for generating the ?currentrow? =
> part</FONT>=20
> <BR><FONT size=3D2>> of the statement above????</FONT> =
> <BR><FONT=20
> size=3D2>></FONT> <BR><FONT size=3D2>> Now, I cannot use the =
> indentity field=20
> .. I don't want values like</FONT> <BR><FONT size=3D2>> Category =
> 2 =20
> ...</FONT> <BR><FONT size=3D2>> Category 19 ...</FONT> =
> <BR><FONT=20
> size=3D2>></FONT> <BR><FONT size=3D2>> And ... I cannot use a =
> CFOUTPUT or=20
> CFLOOP -- I want to do it all in the</FONT> <BR><FONT =
> size=3D2>SQL</FONT>=20
> <BR><FONT size=3D2>> statement if possible!!</FONT> <BR><FONT=20
> size=3D2>></FONT> <BR><FONT size=3D2>></FONT> <BR><FONT =
> size=3D2>>=20
> =
> -------------------------------------------------------------------------=
> -</FONT>=20
> <BR><FONT size=3D2>--</FONT> <BR><FONT size=3D2>> --</FONT> =
> <BR><FONT=20
> size=3D2>> Archives: <A=20
> href=3D"http://www.mail-archive.com/[email protected]/"=20
> =
> target=3D_blank>http://www.mail-archive.com/[email protected]/</A=
> ></FONT>=20
> <BR><FONT size=3D2>> To Unsubscribe visit</FONT> <BR><FONT =
> size=3D2>> <A=20
> =
>
href=3D"http://www.houseoffusion.com/index.cfm?sidebar=3Dlists&body=3D=
> lists/cf_talk"=20
> =
> target=3D_blank>http://www.houseoffusion.com/index.cfm?sidebar=3Dlists&am=
> p;body=3Dlists/cf_talk</A>=20
> or</FONT> <BR><FONT size=3D2>> send a message to=20
> [EMAIL PROTECTED] with 'unsubscribe' in</FONT> =
> <BR><FONT=20
> size=3D2>> the body.</FONT> <BR><FONT size=3D2>></FONT> =
> <BR><FONT=20
> size=3D2>></FONT> <BR><FONT size=3D2>>=20
> =
> **********************************************************************</F=
> ONT>=20
> <BR><FONT size=3D2>> Information in this email is confidential and =
> may be=20
> privileged.</FONT> <BR><FONT size=3D2>> It is intended for the =
> addressee=20
> only. If you have received it in error,</FONT> <BR><FONT size=3D2>> =
> please=20
> notify the sender immediately and delete it from your system.</FONT> =
> <BR><FONT=20
> size=3D2>> You should not otherwise copy it, retransmit it or use =
> or disclose=20
> its</FONT> <BR><FONT size=3D2>> contents to anyone.</FONT> =
> <BR><FONT=20
> size=3D2>> Thank you for your co-operation.</FONT> <BR><FONT =
> size=3D2>>=20
> =
> **********************************************************************</F=
> ONT>=20
> <BR><FONT size=3D2>>=20
> =
> -------------------------------------------------------------------------=
> -</FONT>=20
> <BR><FONT size=3D2>----</FONT> <BR><FONT size=3D2>> Archives: <A=20
> href=3D"http://www.mail-archive.com/[email protected]/"=20
> =
> target=3D_blank>http://www.mail-archive.com/[email protected]/</A=
> ></FONT>=20
> <BR><FONT size=3D2>> To Unsubscribe visit</FONT> <BR><FONT =
> size=3D2><A=20
> =
>
href=3D"http://www.houseoffusion.com/index.cfm?sidebar=3Dlists&body=3D=
> lists/cf_talk"=20
> =
> target=3D_blank>http://www.houseoffusion.com/index.cfm?sidebar=3Dlists&am=
> p;body=3Dlists/cf_talk</A>=20
> or</FONT> <BR><FONT size=3D2>send a message to =
> [EMAIL PROTECTED]=20
> with 'unsubscribe' in</FONT> <BR><FONT size=3D2>the body.</FONT> =
> <BR><FONT=20
> size=3D2>></FONT> </P>
> <P><FONT=20
> =
> size=3D2>----------------------------------------------------------------=
> --------------</FONT>=20
> <BR><FONT size=3D2>Archives: <A=20
> href=3D"http://www.mail-archive.com/[email protected]/"=20
> =
> target=3D_blank>http://www.mail-archive.com/[email protected]/</A=
> ></FONT>=20
> <BR><FONT size=3D2>To Unsubscribe visit <A=20
> =
>
href=3D"http://www.houseoffusion.com/index.cfm?sidebar=3Dlists&body=3D=
> lists/cf_talk"=20
> =
> target=3D_blank>http://www.houseoffusion.com/index.cfm?sidebar=3Dlists&am=
> p;body=3Dlists/cf_talk</A>=20
> or send a message to [EMAIL PROTECTED] with =
> 'unsubscribe' in=20
> the body.</FONT></P></BLOCKQUOTE></BODY></HTML>
>
> ------=_NextPart_000_01B0_01C02310.14845680--
>
> --------------------------------------------------------------------------
----
> 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.
>
------------------------------------------------------------------------------
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.