WestSide wrote:
> Hi,
>
> I am trying to find out how to loop over a query
horizontally in a sense. My
> recordset looks like this:
>
> Column Headers (each number represents a question_id,
and the email column is
> the user's email address )
> 1 | 2 | 3 | 4 | 5 | 6 |7 | 8 | 9 | 10 | 11 | 12 | Email
>
> Sample Values
> 3 | 5 | 3 | 5 | 5 | 4 | 3 | 2 | 5 | 5 | 4 | 1 |
johndoe@test.com
>
> 4 | 4 | 2 | 4 | 5 | 2 | 1 | 2 | 5 | 3 | 4 | 2 |
roger@abccompany.com
>
> --------------
>
> Each row represents multiple answers to multiple
questions. So for a given
> row I need to grab the header which is the question_id,
then grab the
> associated value and insert it into the database. So I
really need to loop
> over each column within the row.
<cfloop from="1" to="#answers.recordCount#" index="i">
<cfloop from="1" to="#ListLen(answers.ColumnList)#"
index="j">
QuestionID=#ListGetAt(answers.ColumnList, j)#
Answer=#answers[ListGetAt(answers.ColumnList, j)]
#
</cfloop>
</cfloop>
--
Mack