OK, so you have this:
<cfset yearQuery = QueryNew("year_num", "Integer")>
<cfset newRow = QueryAddRow(yearQuery, 100)>
<cfloop index="year_number" from="1920" to="2020">
<cfset yearnumber[year_number] = year_number>
<cfset temp =
QuerySetCell(yearQuery,"year_num",#yearnumber[year_number]#,#year_number#)>
</cfloop>
Based on what you are doing with the other queries and what I think
you are trying to do, this will work:
<cfset yearQuery = QueryNew("year_num", "Integer")>
<cfset newRow = QueryAddRow(yearQuery, 100)>
<cfset YearOffset = 1919>
<cfloop index="year_number" from="1" to="100">
<cfset yearnumber[year_number + YearOffset] = year_number + YearOffset >
<cfset temp = QuerySetCell(yearQuery,"year_num",yearnumber[year_number
+ YearOffset],year_number)>
</cfloop>
I got rid of unnecessary # signs too. Why you have a struct of years
containing the same data as the struct's key I don't know, but this
will give you the result you were after.
On 12/29/06, Bruce Sorge <[EMAIL PROTECTED]> wrote:
> OK, so I did not quite understand what I was doing. I thought that I was
> setting 100 cells, and the year range from 1920 - 2020 was 100 years; you
> see where I was going.
> So, then do I put 1920 in there then? I tried 2020 and of course it crated
> 2020 rows which sucked.
>
> Thanks
>
> -----Original Message-----
> From: James Holmes [mailto:[EMAIL PROTECTED]
> Sent: Thursday, December 28, 2006 9:51 PM
> To: CF-Talk
> Subject: Re: Query Problem
>
> You have a query with 100 rows and you are trying to set a cell in row
> 1920. 1920 is greater than 100.
>
> On 12/29/06, Bruce Sorge <[EMAIL PROTECTED]> wrote:
> > Hello.
> > I have these three queries that I am creating below. The first two work
> > great, but the third one gives me the following error:
> >
> > The row number, (1920) is out of bound. This is happening on line 48 which
> > is this one:
> >
> > <cfset temp = QuerySetCell(yearQuery, "year_num",
> #yearnumber[year_number]#,
> > #year_number#)>
> >
> >
> > What is wrong with it? Seems to me it should work.
> >
> >
> > <cfset monthQuery = QueryNew("Month_Number, Month_Name", "Integer,
> > varchar")>
> >
> > <cfset newRow = QueryAddRow(monthQuery, 12)>
> >
> > <cfloop index="loopcount" from=1 to=12>
> > <cfset months[loopcount]=MonthAsString(loopcount)>
> > <cfset monthNumber[loopcount] = loopcount>
> > <cfset temp = QuerySetCell(monthQuery, "Month_Number",
> > #monthNumber[loopcount]#, #loopcount#)>
> > <cfset temp = QuerySetCell(monthQuery, "Month_Name", #months[loopcount]#,
> > #loopcount#)>
> > </cfloop>
> >
> >
> > <cfset dayQuery = QueryNew("Day_Number", "Integer")>
> >
> > <cfset newRow = QueryAddRow(dayQuery, 31)>
> >
> > <cfloop index="loopcount" from="1" to="31">
> > <cfset dayNumber[loopcount] = loopcount>
> > <cfset temp = QuerySetCell(dayQuery, "Day_Number",
> > #dayNumber[loopcount]#, #loopcount#)>
> > </cfloop>
> >
> >
> > <cfset yearQuery = QueryNew("year_num", "Integer")>
> >
> > <cfset newRow = QueryAddRow(yearQuery, 100)>
> >
> > <cfloop index="year_number" from="1920" to="2020">
> > <cfset yearnumber[year_number] = year_number>
> > <cfset temp = QuerySetCell(yearQuery, "year_num",
> > #yearnumber[year_number]#, #year_number#)>
> > </cfloop>
> >
> > Thanks,
> >
> > Bruce Sorge
> >
> >
> >
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265292
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4