Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELPPP. Add item to 2 dimension array with #ArrayAppend#

Status
Not open for further replies.

Tiono

Programmer
Feb 24, 2004
11
0
0
ID
<cfset arrMonthly = arrayNew(2)>
<cfset arrWeekly = arrayNew(2)>
<cfloop query="qAbsen">
<cfif qAbsen.absentPeriodType eq "W">
#ArrayAppend(arrWeekly, week(absentDate))#
<cfif qabsen.absentControl eq "N">
#ArrayAppend(arrWeekly, "a")#
<cfelseif qabsen.absentControl eq "v" and qAbsen.absentProcess eq 0>
#ArrayAppend(arrWeekly, "<font color='##ff0000'>A</font>")#
<cfelseif qabsen.absentControl eq "v" and qAbsen.absentProcess eq 1>
#ArrayAppend(arrWeekly, "A")#
</cfif> <cfelseif qAbsen.absentPeriodType eq "M">
#ArrayAppend(arrMonthly, month(absentDate))#
<cfif qabsen.absentControl eq "N">
#ArrayAppend(arrMonthly, "a")#
<cfelseif qabsen.absentControl eq "v" and qAbsen.absentProcess eq 0>
#ArrayAppend(arrMonthly, "<font color='##ff0000'>A</font>")#
<cfelseif qabsen.absentControl eq "v" and qAbsen.absentProcess eq 1>
#ArrayAppend(arrMonthly, "A")#
</cfif> </cfif>
</cfloop>

I got this error when executing the code above.

Array dimension error.
If an array with more then one dimension is passed to this function, the value passed to the array must be an array with one less dimension.

anybody please help
 
did you ever get this working? im having the EXACT same problem!
 
Note, below, the line in bold.. How I don't set ArrX to the arrayAppend function... ArrayAppend returns a boolean value, so in effect, if I set ArrX to that, I'd be setting ArrX to true or false..

Two dimensional arrays are arrays of arrays, basically, and three dimensional arrays are arrays of arrays of arrays..

Anyway this is the first time I've tried this so I'm not to fluent on the terminology..

Also you can use ArrayLen(ArrX[1]) to get the position count of the 2nd dimension of Dimension 1 Position 1.
Code:
<Cfset ArrX=ArrayNew(2)>

<cfset ArrX[1][1]="one">
[b]<cfset ArrayAppend(ArrX[1],"two")>[/b]

<cfoutput>
 #ArrX[1][1]#
 #ArrX[1][2]#
</cfoutput>

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top