I said:
>> <CFIF NOT StructKeyExists(struct,var)>
>> <CFSET struct[var]="">
>> </CFIF>
>> <CFSET struct[var]=ListAppend(struct[var],value)>
To which Dave said:
> You can do this in 4.5.x with StructInsert. If you specify a fourth
> argument, you can allow it to both insert and update:
> <cfset rs = StructInsert(struct, var, value, "true")>
Ummm, not quite. It'd be more like:
<!--- This doesn't work --->
<CFSET
StructInsert(struct,var,ListAppend(StructFind(struct,var),value),"true")>
<!--- Nor does this --->
<CFSET StructUpdate(struct,var,ListAppend(StructFind(struct,var),value))>
But, you can't do that because the StructFind() will fail if var is not
already a part of struct. Replacing StructFind() with an operator[] call
won't work, either, for the same reason.
>I'm not sure when StructKeyArray and StructKeyList were introduced,
> but they're listed in the documentation within CF Studio 4.5.1.
Tres cool. :) I'd missed them, completely. Interesting how the
documentation says that they will return the keys in any order, but they are
always alphabetical (just as they have always been). Wonder what the deal
with that is?
At any rate, I guess I'll have to update my little function cheatsheet that
I have on my wall. Anyone got a one-page PDF of the functions and their
parameters that is up to date? I could make one, but if there is one
already out there, then I shan't bother.
Thanks,
Rick
------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message
with 'unsubscribe' in the body to [EMAIL PROTECTED]