Copy link to clipboard
Copied
I get this error when running this query from a custom tag using this array:
Element 13 is undefined in a CFML structure referenced as part of an expression.
Query:
<cfif mode is "update" and type is "request">
<cfdump var="#session.aDelgtRR#" />
<cftry>
<cfloop List="#ArrayLen(session.aDelgtRR)#" index="x">
<cfloop List="#ArrayLen(session.aDelgtRR
<!--- 12/18/09 nothing I've tried works. Still get undefined error in cfcatch
<cfif NOT ArrayIsEmpty(session.aDelgtRR[#x#].session.AreaID)> --->
<cfloop List="#ArrayLen(session.aDelgtRR
<cfquery name="qUpUserRemove_Rqst" datasource="#request.at_datasource#">
UPDATE JOB_DelgtAreaRole
Set RemoveType=<cfqueryparam value="#session.aDelgtRR
RemoveRqstStat=<cfqueryparam value="SUBMITTED" cfsqltype="CF_SQL_VARCHAR" />,
Updated=<cfqueryparam value="#now()#" cfsqltype="CF_SQL_TIMESTAMP" />,
WhoUpdated=<cfqueryparam value="#IHSUID#" cfsqltype="CF_SQL_INT" />
WHERE IHSUID = <cfqueryparam value="#session.aDelgtRR
and IHSAreaAssignedID = <cfqueryparam value="#session.aDelgtRR
and fk_JobUser_Role = <cfqueryparam value="#session.aDelgtRR
</cfquery>
</cfloop>
<!--- <cfelse>
</cfif> --->
</cfloop>
</cfloop>
<cfcatch type="coldfusion.runtime.UndefinedElementException"><cfdump var="Undefined error" /></cfcatch>
<cfcatch type="coldfusion.runtime.CfJspPage$ArrayBoundException"><cfdump var="Array Bound error" /></cfcatch>
</cftry>
</cfif>
<cfcatch type="Any">
<cftransaction action="rollback" />
<cfset ArrayAppend(session.serror,"Your submission has encountered an error.") />
</cfcatch>
</cftry>
</cftransaction>
array | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2 |
|
Copy link to clipboard
Copied
To start, you have this:
<cfloop List="#ArrayLen(session.aDelgtRR)#" index="x">
<cfloop List="#ArrayLen(session.aDelgtRR
Just for fun, do this:
<cfldump var ="#ArrayLen(session.aDelgtRR)#">
<cfcump var="#ArrayLen(session.aDelgtRR
<cfabort>
Are there any similarities between what you see and what you expected to see?
Copy link to clipboard
Copied
I did this:
<cfloop List="#ArrayLen(session.aDelgtRR)#" index="x">
<cfloop List="#ArrayLen(session.aDelgtRR
aDegtRR length: <cfdump var="#ArrayLen(session.aDelgtRR)#">
aDegtRR Area ID length: <cfdump var="#ArrayLen(session.aDelgtRR
<cfabort />
And got this:
AreaID length should be 13 for each aDelgtRR length.
Then I did this:
<cfloop List="#ArrayLen(session.aDelgtRR)#" index="x">
<cfloop List="#ArrayLen(session.aDelgtRR
<cfloop List="#ArrayLen(session.aDelgtRR
aDegtRR length: <cfdump var="#ArrayLen(session.aDelgtRR)#">
aDegtRR Area ID length: <cfdump var="#ArrayLen(session.aDelgtRR
aDegtRR Area ID Job Role length: <cfdump var="#ArrayLen(session.aDelgtRR
And got this:
aDegtRR length:2 aDegtRR Area ID length:13 aDegtRR Area ID Job Role length:0Undefined error
Copy link to clipboard
Copied
You're making progress. If this: aDegtRR length: <cfdump var="#ArrayLen(session.aDelgtRR)#">
gives you this: aDegtRR length: 13
It tells you that the array has 13 elements. So far, so good.
Then if you do this:
<cfloop List="#ArrayLen(session.aDelgtRR)#" index="x">
<cfdump var="x is #x#"><br>
</cloop>
Do you see what you expected to see?
Copy link to clipboard
Copied
I so appreciate you helping me out !!
I didn't get what you indicated.
There are 2 delgts. Each delgt will have 13 areas. Only some areas will have job roles.
This give me a length of 2: aDegtRR length:
This give me a length of 13: aDegtRR Area ID length: <cfdump var="#ArrayLen(session.aDelgtRR
Copy link to clipboard
Copied
Maybe this will make it more clear. From what you said, ArrayLen(session.aDelgtRR) is 2, and ArrayLen(session.aDelgtRR
<cfoutput>
<cfloop List="#ArrayLen(session.aDelgtRR)#" index="x">
x is #x# <br>
<cfloop List="#ArrayLen(session.aDelgtRR
y is #y# <br>
</cfloop>
</cfloop>
<hr>
</cfoutput>
Copy link to clipboard
Copied
I got what I expected:
x is 2
y is 13
In the first pass through the array, Delgtid 8074, element 13 is the only one that actually has job roles.
The second pass, for Delgtid 14599, has jobroles for area 1 and 10, but does not have any job roles for element 13.
Thanks for your help, Dan.