Gary, 

This is happening because technically "MyQueryArray[1]" is not a valid
variable name. See, in the query attribute of the CFOutput tag, you
aren't actually passing in a value such as #MyQueryArray[1]#. You are
just passing in a variable name. ColdFusion then has to take that
variable name and find the variable you are referring to. Since
MyQueryArray[1] is *not* a proper variable name, this fails.

The intermediary solution you had below does work because you create a
valid variable name that has  reference to the query in question.

So, just to clarify, if you had the query in a structure:

objStruct[ "querykey" ]

You could NOT pass in :  objStruct[ "querykey" ] to the CFOutput tag....
However, you COULD pass in objStruct.querykey as that IS a valid
variable name.

Small caveat, but it can mess you up.


......................
Ben Nadel
Certified Advanced ColdFusion MX7 Developer
www.bennadel.com
 
Need ColdFusion Help?
www.bennadel.com/ask-ben/

-----Original Message-----
From: Gary Boyle [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 13, 2007 7:25 AM
To: CF-Talk
Subject: Array Variable Problem

Hi folks,

I have an array of queries called MyQueryArray.  When I tried to do some
processing based on the first array of the query I was getting an error:

        <cfoutput query = "MyQueryArray[1]">
                <!----processing at this point --->
                .
                .               
        </cfoutput>

The error I was getting was: 

        Attribute validation error for tag cfoutput.  
        The value of the attribute query, which is currently
"MyQueryArray[1]", is invalid. 


But I did find a solution:

        <cfset temp = MyQueryArray[1]>
        
        <cfoutput query = "temp">
                <!----processing at this point --->
                .
                .
        </cfoutput>
        
This works grand.  I get the results I expect, but I'm just wondering
why I have to do this?  I'm also wondering if this might highlight a
deeper underlying problem (or quirk)?  I can see that ColdFusion doesn't
like this direct insertion of variables.  If anyone can enlighten me as
to why this is, that would be great.
                        
NB The code snippets aren't my actually code but just used to illustrate
my point.

Gary



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

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

Reply via email to