Re: cfquery result="resultInfo"

2009-03-19 Thread Phillip Senn

This is the syntax for doing it with an array of structures:


SELECT * FROM Tablename





What would be the syntax for using a structure of structures?


> > Q: What's the best way to return two structures from a function?
> > Should I return an array of structures or can I return the 
> resultInfo in one of the arguments
> > from the calling program?
> 
> Well, strictly speaking, if you set the value of something within the
> calling program that's not returning a value. You'll want to return a
> single value, which could be an array or a structure. It really
> doesn't matter which you do. I'd probably return a structure with
> both, if I wanted to return both, so that I could then refer to the
> contents of that structure by name instead of by position. Arrays are
> generally used to hold a bunch of items of the same type, although CF
> doesn't force you to only put items of one type within an array as
> many other languages do.
> 
> Gerald's point about returning arrays of structures is useful if
> you're going to interact with non-CF systems, but those systems won't
> be able to consume a query object anyway, so that's not too important
> in this case. If you wanted to write a service which could be 
> consumed
> by other platforms, you'd have to return the query itself as an array
> of structures.
> 
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
> 
> Fig Leaf Software provides the highest caliber vendor-authorized
> instruction at our training centers in Washington DC, Atlanta,
> Chicago, Baltimore, Northern Virginia, or on-site at your location.
> Visit http://training.figleaf.com/ for more 
information! 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320721
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfquery result="resultInfo"

2009-03-19 Thread Dave Watts

> Q: What's the best way to return two structures from a function?
> Should I return an array of structures or can I return the resultInfo in one 
> of the arguments
> from the calling program?

Well, strictly speaking, if you set the value of something within the
calling program that's not returning a value. You'll want to return a
single value, which could be an array or a structure. It really
doesn't matter which you do. I'd probably return a structure with
both, if I wanted to return both, so that I could then refer to the
contents of that structure by name instead of by position. Arrays are
generally used to hold a bunch of items of the same type, although CF
doesn't force you to only put items of one type within an array as
many other languages do.

Gerald's point about returning arrays of structures is useful if
you're going to interact with non-CF systems, but those systems won't
be able to consume a query object anyway, so that's not too important
in this case. If you wanted to write a service which could be consumed
by other platforms, you'd have to return the query itself as an array
of structures.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320695
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfquery result="resultInfo"

2009-03-19 Thread Gerald Guido

>>and have already picked up a nugget.

A tasty one at that. Thanx for sharing.

>>Should I return an array of structures

I would say yes. From what I have been reading, arrays of structures is the
standard way to exchange data between platforms (Think web services). If you
do it that way (arrays of structures) systems using Java, .NET, PHP etc.will
be able to call the CFC as a web service if the need ever arises.

G!

On Thu, Mar 19, 2009 at 10:23 AM, Phillip Senn wrote:

>
> I am reading the cfcurriculum at
> http://www.adobe.com/education/instruction/teach/cfcurriculum.html
> and have already picked up a nugget.
>
> I didn't realize that cfquery returned two results, the name= attribute and
> the result= attribute.
> I've always just returned the query in my functions, but now I'm
> considering returning both the query and the result info.
>
> Q: What's the best way to return two structures from a function?
> Should I return an array of structures or can I return the resultInfo in
> one of the arguments from the calling program?
>
>
>
> 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320693
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfquery result

2006-10-19 Thread Richard White
thats brilliant, thanks for all your advice

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:257521
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: cfquery result

2006-10-19 Thread Dave Watts
> Hi, i hope this is a very simple question! but i want to be 
> able to call a query but i want the result of the query to be 
> stored in a structure format so that i can use in cfscript, 
> the only examples i can find is if the result is used in a 
>  
> could someone possibly provide a simple example on how to 
> store the result in a sturcture format so that i can use it 
> in cfscript

Well, you can't really store a query in a structure, in a meaningful way. A
query is a two-dimensional representation of data - rows and columns. A
structure, by itself, is not. You could copy query data into a structure of
arrays, or a structure of structures, or an array of arrays, however.

Fortunately, though, there's no need to do this. You can simply reference
query values within CFSCRIPT. If you want to loop over a query, there's no
direct analog to CFOUTPUT but you can build a loop that does what you need.


#qFoo.col1#


would be:

for (i = 1; i lte qFoo.RecordCount; i = i + 1) {
WriteOutput(qFoo.col1[i] & "");
}

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:257519
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfquery result

2006-10-19 Thread Teddy Payne
You can reference a query in cfscript:


select
col1, col2
from




rownum = 0;

while (row lt qryName.RecordCount)
 {
  rownum = IncrementValue(rownum);
  col1= qryName.col1[rownum];
  col2 = qryName.col2[rownum];
 }


On 10/19/06, Richard White <[EMAIL PROTECTED]> wrote:
>
> Hi, i hope this is a very simple question! but i want to be able to call a
> query but i want the result of the query to be stored in a structure format
> so that i can use in cfscript, the only examples i can find is if the result
> is used in a 
> could someone possibly provide a simple example on how to store the result
> in a sturcture format so that i can use it in cfscript
>
> thanks very much
>
>
>
>
> 

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:257500
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: cfquery result

2006-10-19 Thread Turetsky, Seth
Don't need to do that...as it's already a structure.  Just loop through it, ie:

for (x=1; x LTE queryName.recordcount; x=x+1) 
queryName.columnName[x]

-Original Message-
From: Richard White [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 19, 2006 4:50 PM
To: CF-Talk
Subject: cfquery result

Hi, i hope this is a very simple question! but i want to be able to call a 
query but i want the result of the query to be stored in a structure format so 
that i can use in cfscript, the only examples i can find is if the result is 
used in a http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:257498
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfquery result=""

2005-11-30 Thread Ryan Guill
Thats what I figured.

Thanks for checking for me though.


On 11/30/05, Kerry <[EMAIL PROTECTED]> wrote:
> 6.1 says:
> Attribute validation error for tag CFQUERY.
> The tag does not allow the attribute(s) RESULT
>
> -Original Message-
> From: Ryan Guill [mailto:[EMAIL PROTECTED]
> Sent: 30 November 2005 14:11
> To: CF-Talk
> Subject: cfquery result=""
>
>
> This is probably a dumb question, but I'll ask just to make sure.
>
> Does someone have a 6.1 box they can test something on for me? I just
> want to know if you have a cfquery tag with a result attribute if it
> will fail on 6.1?  Im sure it will, but it would be awesome if it
> didn't...
>
> 
>
> 
> --
> Ryan Guill
> BlueEyesDevelopment
> [EMAIL PROTECTED]
> www.ryanguill.com
> (270) 217.2399
> got google talk?  Chat me at [EMAIL PROTECTED]
>
> The Coldfusion Open Application Library - COAL - http://coal.ryanguill.com
>
> www.ryanguill.com/
> The Roman Empire: www.ryanguill.com/blog/
>
>
>
> 

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:225672
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


RE: cfquery result=""

2005-11-30 Thread Kerry
6.1 says:
Attribute validation error for tag CFQUERY.
The tag does not allow the attribute(s) RESULT

-Original Message-
From: Ryan Guill [mailto:[EMAIL PROTECTED]
Sent: 30 November 2005 14:11
To: CF-Talk
Subject: cfquery result=""


This is probably a dumb question, but I'll ask just to make sure.

Does someone have a 6.1 box they can test something on for me? I just
want to know if you have a cfquery tag with a result attribute if it
will fail on 6.1?  Im sure it will, but it would be awesome if it
didn't...




--
Ryan Guill
BlueEyesDevelopment
[EMAIL PROTECTED]
www.ryanguill.com
(270) 217.2399
got google talk?  Chat me at [EMAIL PROTECTED]

The Coldfusion Open Application Library - COAL - http://coal.ryanguill.com

www.ryanguill.com/
The Roman Empire: www.ryanguill.com/blog/



~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:225671
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


RE: cfquery result=""

2005-11-30 Thread Robertson-Ravo, Neil (RX)
It will fail in 6.1 - it is 7 only AFAIK.





-Original Message-
From: Ryan Guill [mailto:[EMAIL PROTECTED] 
Sent: 30 November 2005 14:11
To: CF-Talk
Subject: cfquery result=""

This is probably a dumb question, but I'll ask just to make sure.

Does someone have a 6.1 box they can test something on for me? I just
want to know if you have a cfquery tag with a result attribute if it
will fail on 6.1?  Im sure it will, but it would be awesome if it
didn't...




--

Ryan Guill
BlueEyesDevelopment
[EMAIL PROTECTED]
www.ryanguill.com
(270) 217.2399
got google talk?  Chat me at [EMAIL PROTECTED]

The Coldfusion Open Application Library - COAL - http://coal.ryanguill.com

www.ryanguill.com/
The Roman Empire: www.ryanguill.com/blog/



~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:225668
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54