Hi Chong, I'd ckeck for null by using IsDefined and dot notation. While the key may exist, the value could be null.
Something like; <cfif IsDefined('myStruct') and IsDefined('myStruct.myKey')> <cfset myValue = myStruct[myKey]> </cfif> Or cfscript eqivalent ;) Seems like overkill, but it might help reveal what's missing. On 11/25/09, Blair McKenzie <shi...@gmail.com> wrote: > Is it possible "x in y" is returning items that aren't technically struct > keys? > > Blair > > On Wed, Nov 25, 2009 at 5:05 PM, KC Kuok <kck...@gmail.com> wrote: > >> Before i forget STRUCTVARIABLE = structCopy(Bigstruct.byExportKey >> [ExportID]) was without the structCopy before... did not make a >> difference... >> >> On Nov 25, 5:04 pm, KC Kuok <kck...@gmail.com> wrote: >> > The struct is copied from a struct of struct generated earlier in the >> > process, which parses an xml file... >> > Then it loops through the Struct of Structs to do the logic. I am >> > amazed that I can do a dump of the variable and the temp Struct on the >> > line right before, but yet it says it is undefined when it hits that >> > line... >> > >> > Is it something to do with scoping in For loops in CFSCRIPT... this is >> > done in CF8 btw... >> > >> > for (portalExportID in Bigstruct.byExportKey) >> > { >> > STRUCTVARIABLE = structCopy(Bigstruct.byExportKey[ExportID]) >> > ... >> > ... >> > ThisValue = STRUCTVARIABLE.THISFOREIGNKEY; >> > ... >> > ) >> > >> > If its nothing obvious I will probably rewrite it bit by bit and see >> > what makes the difference... >> > >> > On Nov 25, 4:45 pm, Mark Mandel <mark.man...@gmail.com> wrote: >> > >> > > Where did the struct come from? >> > >> > > Maybe it's a Java Map object? >> > >> > > Mark >> > >> > > On Wed, Nov 25, 2009 at 4:37 PM, KC Kuok <kck...@gmail.com> wrote: >> > > > When I try to get key value from a structure I get an error however >> if >> > > > I do a dump function, I can see the struct AND the variable which is >> > > > referred to similarly. >> > >> > > > E.g. >> > > > ... >> > > > ThisValue = STRUCTVARIABLE.THISFOREIGNKEY; >> > > > ... >> > >> > > > I get >> > >> > > > Element THISFOREIGNKEY is undefined in STRUCTVARIABLE >> > >> > > > However If I do a dump function, dodump(STRUCTVARIABLE) or even >> dodump >> > > > (STRUCTVARIABLE.THISFOREIGNKEY ) just before that line I can see the >> > > > entire structure or just the value respectively. I can't see what is >> > > > wrong, could this be a cfscript related bug ? Or am I missing >> > > > something real obvious ? >> > >> > > > One of the things I thought maybe wrong is the scope, but even then >> it >> > > > does not seem that anything is wrong with it... >> > >> > > > Dodump() is just a regular cffunction which passes the args to >> > > > cfdump >> > > > inside. >> > >> > > > Any thoughts? >> > >> > > > Thanks in advance! >> > > > Chong >> > >> > > > -- >> > >> > > > You received this message because you are subscribed to the Google >> Groups >> > > > "cfaussie" group. >> > > > To post to this group, send email to cfaus...@googlegroups.com. >> > > > To unsubscribe from this group, send email to >> > > > cfaussie+unsubscr...@googlegroups.com<cfaussie%2bunsubscr...@googlegroups.com> >> <cfaussie%2bunsubscr...@googlegroups.com<cfaussie%252bunsubscr...@googlegroups.com> >> > >> > > > . >> > > > For more options, visit this group at >> > > >http://groups.google.com/group/cfaussie?hl=en. >> > >> > > -- >> > > E: mark.man...@gmail.com >> > > T:http://www.twitter.com/neurotic >> > > W:www.compoundtheory.com >> >> -- >> >> You received this message because you are subscribed to the Google Groups >> "cfaussie" group. >> To post to this group, send email to cfaus...@googlegroups.com. >> To unsubscribe from this group, send email to >> cfaussie+unsubscr...@googlegroups.com<cfaussie%2bunsubscr...@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/cfaussie?hl=en. >> >> >> > > -- > > You received this message because you are subscribed to the Google Groups > "cfaussie" group. > To post to this group, send email to cfaus...@googlegroups.com. > To unsubscribe from this group, send email to > cfaussie+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/cfaussie?hl=en. > > > -- Sent from my mobile device -- You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to cfaus...@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en.