If you have 35 form variables that you want to insert into a database, why not
just do it? What do you need to create arrays, structures, or anything else at
Originally posted by: mushBug
I am trying to create an array of structures using data collected from a form.
The form contains 5 sets of seven fields each set containing various
information for a different person. The fields in each set are named with a
corresponding prefix identifying that particular person's role (e.g., role_1,
role_2, etc.), and a corresponding suffix identifing what part of that person'd
data it contains (e.g., first name, middle name, last name, ID, etc.) so that a
set of fields for any given person would look like this:
For the purpose of inserting this data into a database, I want to separate the
prefix from the suffix and creat a CF Data Structure for each set of fields so
that the keys of each structure are generically renamed such as:
Then insert each of these structures into an Array ending up with an array of
So far, I am able to creat one giant structure containng all of the form
fields with their field names (roleX_ID, etc.) as the keys and the field values
as the values in the structure.
From here I dump all of the keys of this structure into an Array using --
structKeyArray(aryPersonnel) -- and loop through that array looking for
particular elements (ID, EMail, etc.) to be contained in the key. If it
matches a condition, I set a new value in a new structure equal to the valuel
that matches the key I'm examining.
Nice plan, but unfortunatly it does not render my desired result. I end up
with an array that contains 35 different structures instead of an array
containing 5 structures each with the seven key/value pairs of information.
I believe the problem may be in the way I am looping through the array, since
the conditions I have set would be met more than once through each iteration of
I'm almost out of ideas so any help would be greatly appreciated. I have
attached some code for review.
-- Thanks in advance