I'm new to using structures, and am having difficultly adding elements to an
existing structure.

Here's the code snippet:

<cfoutput query="getFlexDays">
<cfset requestLimit.Date[currentrow] =
DateFormat(getFlexDays.flexRequestDateRequested, "mm/dd/yyyy")>
<cfset requestLimit.Threshold[currentrow] =
getFlexDays.flexDayThresholdMax>
<cfset requestLimit.RequestCount[currentrow] =
getFlexDays.flexRequestCount>
<cfset requestLimit.Blackout[currentrow] =
getFlexDays.flexDayBlackout>
</cfoutput>

<cfset counter = StructCount(requestLimit)>

<cfloop from="1" to="#Days#" index="x">
<cfset counter = incrementValue(counter)>
<cfset dateTest = DateFormat(CreateDate(Year, Month, x),
"mm/dd/yyyy")>
<cfif structkeyexists(requestLimit, #dateTest#)>
<cfelse>
<cfset StructInsert(requestLimit[counter], "Date",
#DateFormat(CreateDate(Year, Month, x), "mm/dd/yyyy")#)>
<cfset StructInsert(requestLimit[counter],
"Threshold", 0)>
<cfset StructInsert(requestLimit[counter],
"RequestCount", 0)>
<cfset StructInsert(requestLimit[counter],
"Blackout", 0)>
</cfif>
</cfloop>

There are 4 elements in the structure from the population in the output
query.  When the fifth is added in the loop, I get this error message:

Element 5 is undefined in a CFML structure referenced as part of an
_expression_.
Any pointers would be appreciated.  Thanks!
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to