Reputation: 111
I have a one dimensional array that has 3 values in it. I need to access the value at index 2 and store it in a variable.<cfoutput><cfset myvar= #myarray[2]#></cfoutput>
When I try this I get the following error "Complex object types cannot be converted to simple values." Any help would be appreciated.
Adding in extra code
<cfset myarray=ArrayNew(1)>
<cfset counter = 1>
<cfloop list="#url.TableName#" index="y">
<cfquery name="findgreatest" dbtype ="query">
SELECT max(arn) as recno from qSort
WHERE tbl = '#y#'
</cfquery>
<cfset nextTBRC[counter] = ["#findgreatest.recno#"]>
<cfset counter = counter + 1>
</cfloop>
<cfoutput>
<cfset myvar = "#nextTBRC[2]#">
<div>#myvar#</div>
</cfoutput>
Upvotes: 1
Views: 1993
Reputation: 431
It seems you are assigning an array:
<cfset nextTBRC[counter] = ["#findgreatest.recno#"]>
Should be:
<cfset nextTBRC[counter] = findgreatest.recno>
Upvotes: 3