well, the 2nd dimension of the first array contains the # of answers
to test 1 (again, minus 1 since the first element of the 2nd dimesion
is specifying the test #).
so loop over the first dimension and do an arrayLen() - 1 on the
second dimension.
<cfoutput>
<cfloop from="1" to="#arrayLen(QstnKey)#" index="i">
Test #i#: #arrayLen(QstnKey[i]) - 1# Questions<br />
</cfloop>
</cfoutput>
This works, since multi-dimensional arrays in CF are just 1d arrays of
1d arrays.
(disclaimer: the #arrayLen(QstnKey[i]) - 1# notation will not work pre-CFMX)
On Fri, 10 Dec 2004 16:31:43 -0400, Joy Holman <[EMAIL PROTECTED]> wrote:
> I appreciate your answer and will look into using structures and CFC's, but
> in the meantime, the answer you gave to my question, I think is assuming that
> each question is a test. The situation is as below, where the first test has
> 2 questions and each question has three choices.
>
> Using this code:
>
> <cfscript>
> QstnKey = ArrayNew(3);
> QstnKey[1][1][1] = "TEst1";
> QstnKey[1][2][1]="a. choice 1";
> QstnKey[1][2][2]="b. choice 2";
> QstnKey[1][2][3]="c. choice 3";
> QstnKey[1][3[1]="a. choice 1";
> QstnKey[1][3[2]="b. choice 2";
> QstnKey[1][3[3]="c. choice 3";
> QstnKey[2][1][1]="Test2";
> QstnKey[2][2][1]="a. choice 1";
> QstnKey[2][2][2]="b. choice 2";
> QstnKey[2][2][3]="c. choice 3";
> QstnKey[2][3][1]="a. choice 1";
> QstnKey[2][3][2]="b. choice 2";
> </cfscript>
>
> How could I dynamically determine the number of questions per test? The
> answer for Test1 = 2.
>
> Thanks.
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Silver Sponsor - CFDynamics
http://www.cfdynamics.com
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:187123
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54