> I am playing around with arrays for the first time and I get this error
> when I try to initialize an array with more than 3 columns.
> Can arrays only have 3 columns?
>
> jon
> Error Diagnostic Information
> Parameter 1 of function ArrayNew which is now "4" must be an integer in
> the range 1 to 3 inclusive
>
> The error occurred while evaluating the expression:
>
>
>  pricebreaks = ArrayNew(pricebreak_columns)



No, but an array may have only 3 dimensions.

My guess is that you may want a two dimensional array.  Arrays in CF can be
dynamically sized, so you needn't declare the number of rows or columns (for
a two-dimensional array), you just declare the number of dimensions when you
call the ArrayNew() function.

Use something like:

<cfset pricebreaks = ArrayNew(2)>

<cfset pricebreaks[1,1] = 50>
<cfset pricebreaks[1,2] = 125>
<cfset pricebreaks[1,3] = 210>
<cfset pricebreaks[1,4] = 300>
<cfset pricebreaks[1,5] = 690>
<cfset pricebreaks[2,1] = 30>
<cfset pricebreaks[2,2] = 75>
<cfset pricebreaks[2,3] = 100>
<cfset pricebreaks[2,4] = 190>
<cfset pricebreaks[2,5] = 250>
<cfset pricebreaks[3,1] = 12>
... etc.


Jim

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to