yes it is. What was messing me up though was not realizing that passed form
fields are actually structures. So, I was basically creating a structure of
a structure when all I had to do was parse through the existing one. Now
that I know that, I understand and will have a much easier time of it next
time.

Bruce

On 12/19/06, Christopher Jordan <[EMAIL PROTECTED]> wrote:
>
> Bruce,
>
> I had trouble getting my head around structures too (about two years
> ago), and now they're like my best friend. :o) I can probably help you
> to get your head around them too if you like.
> You solved your problem using a two dimensional array. That's fine. That
> works, but in referencing it later it would probably be nice to have an
> array of structures. I'll try and work with your example to show you
> what I mean. (or at least this is what I *think* your example was trying
> to accomplish). :o'
>
> GIVEN: Form.FieldNames = "Germany,UK,Spain,Australia,Marz"
>        Form.Germany = "German"
>        Form.UK = "English"
>        Form.Spain = "Spanish"
>        Form.Australia = "English"
>        Form.Marz = "Martian"
>
> Then you could do something like this:
> <CFSet WorldLanguages = ArrayNew(1)>
>
> <CFLoop index="i" from="1" to="#ListLen(Form.FieldNames)#">
>     <CFSet ThisCountry = ListGetAt(Form.FieldNames, i)>
>     <CFSet WorldLanguages[i] = StructNew()>
>     <CFSet WorldLanguages[i].Country = ThisCountry>
>     <CFSet WorldLanguages[i].Language = Trim(Form[ThisCountry])>
> </CFLoop>
>
> What this code should result in is a single dimensioned array each
> element of which is a structure. This makes for easy looping and easy
> reference. It's *almost* the same as referencing a query object
> (queryName.columnName). One thing that *really* helped me to get my head
> around this stuff, was to dump these structures and arrays and what-not
> using CFDump. It's amazing the clarity that I gained from seeing these
> things graphically represented on screen! It was the "click" that I
> needed to get me over the hump of understanding.
>
> Notice also, that it's not really necessary to use StructInsert (there
> may be advantages to doing so, but if there are I don't know of them).
> You can simply follow the name of your struct (i.e. MyStruct) by a
> period and a key name. It didn't have to exist up until that point. By
> the act of assigning a value to the structure key (<CFSet
> MyStruct.KeyName = "Hello World"), you have just created that key as a
> member of that structure, and given it a value.
>
> Easy right? :o)
>
> If you still want help understanding structures, give a shout and I'd be
> happy to help you out however I can. Best of all, use CFDump to look at
> these things. It gives amazing clarity. :o)
>
> Cheers,
> Chris
>
> Bruce Sorge wrote:
> > OK, I figure it out so please disregard the last message.
> >
> > I did it like this:
> >
> > <!--- Create the initial array --->
> > <cfset languageArray= ArrayNew(1)>
> >
> > <!--- Loop through the form fields and get the names of them--->
> >     <cfloop index="i" list="#form.fieldnames#">
> > <!--- If the field is not empty, get the info --->
> > <cfif  LEN(form[i])>
> >      <cfset languageArray[1][1] = #i#>
> >      <cfset languageArray[1][2] = #evaluate("form.#i#")#>
> >      <!--- Query will go here soon --->
> >     </cfif>
> >     </cfloop>
> >
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
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:264504
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to