On Thu, Jan 14, 2010 at 2:46 PM, Jason Allen <[email protected]> wrote:

> But as I researched this, I found that (according to cfDocs @ Adobe)
> structkeyexists only works on form and url scopes.


Either you're misreading the docs or the docs are wrong. StructKeyExists()
works on any struct.


> So I'm not sure how
> this applies to regular variables and query results.


Well, it won't if those variables aren't structs. ;-) But luckily
practically everything in CFML is a struct.


> Basically, some of the instances where #index# will be used is in the
> name of a query variable.
>
> aka.
>
> myquery_1.my_column
>
> =
>
> myquery_#index#.my_column
>

This wouldn't involve StructKeyExists anyway. If that's the only way to do
what you want, you'd have to use Evaluate(). StructKeyExists() would be used
if you wanted to see if my_column existed in your query, but not inline on
the actual query name like you're trying to do there.

Bit of an aside, but queries (and most other CFML datatypes) can be treated
as structs, so you can do things like myQuery.myColumn[rownumber] or
myQuery[myColumn][rownumber] to get at query data in different ways. But if
the actual *name* of the query is dynamic, you'd have to use Evaluate() or
come up with a different way of accomplishing what you're trying to do.

As far as the form scope goes, remember you can use bracket notation there
too:
form[variablehere]
form["dynamic_#stuff#_here"]

That lets you throw variables into the mix in ways that aren't possible with
dot notation.

-- 
Matthew Woodward
[email protected]
http://mpwoodward.posterous.com
identi.ca/Twitter: @mpwoodward

Please do not send me proprietary file formats such as Word, PowerPoint,
etc. as attachments.
http://www.gnu.org/philosophy/no-word-attachments.html
-- 
Open BlueDragon Public Mailing List
 http://www.openbluedragon.org/   http://twitter.com/OpenBlueDragon
 mailing list - http://groups.google.com/group/openbd?hl=en

 !! save a network - please trim replies before posting !!

Reply via email to