Raymond,

In this code here the array is only populated in the first position. So it 
would once loop once. I did however change the counter/index to a variable 
that is not used inside the loop just to be on the safe side. But this code 
does work some times and then some times it generates the error I mentioned 
yesterday.

Brook

At 06:58 AM 7/6/2003 -0500, you wrote:
>So, I did a quick test, and while I didn't get an error, the use of x
>inside the loop confuses the loop counter and the loop runs once, not
>twice.
>
><cfset descriptlistarray = arrayNew(1)>
><cfset descriptlistarray[1] = "f,g,a,a,a">
><cfset descriptlistarray[1] = "z,g,a,a,a">
>
><cfset ret = structNew()>
><cfset ret.cleanedstring ="">
><cfloop from="1" to="#arraylen(descriptlistArray)#"  index="x">
>           <!--- convert the form element descript to an array --->
>           <cfset x=listtoarray(descriptlistArray[x])>
>
>           <!--- more code here --->
>                         <cfoutput>x5 = #x[5]#</cfoutput>
>           <cfset ret.cleanedstring=listappend(ret.cleanedstring,x[5])>
>  </cfloop>
>
>So, like I said, the main thing you want to do is change to a new
>variable inside the loop AND make sure that descriptlist[x] is a list w/
>at least 5 members.
>
>
>========================================================================
>===
>Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
>(www.mindseye.com)
>Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)
>
>Email    : [EMAIL PROTECTED]
>Blog     : www.camdenfamily.com/morpheus/blog
>Yahoo IM : morpheus
>
>"My ally is the Force, and a powerful ally it is." - Yoda
>
> > -----Original Message-----
> > From: Raymond Camden [mailto:[EMAIL PROTECTED]
> > Sent: Sunday, July 06, 2003 5:51 AM
> > To: CF-Talk
> > Subject: RE: Caching cfc objects in the application scope
> >
> >
> > That's what confuses me - if the code did create an error, it
> > should do it every single time, that is, of course, assuming
> > that this branch of code is running everytime. Something else
> > to consider, you use the 5th item in the array, are you
> > checking to make sure arrayLen is gte 5?
> >
> > ==============================================================
> > ==========
> > ===
> > Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
> > (www.mindseye.com)
> > Member of Team Macromedia
> > (http://www.macromedia.com/go/teammacromedia)
> >
> > Email    : [EMAIL PROTECTED]
> > Blog     : www.camdenfamily.com/morpheus/blog
> > Yahoo IM : morpheus
> >
> > "My ally is the Force, and a powerful ally it is." - Yoda
> >
> > > -----Original Message-----
> > > From: Brook Davies [mailto:[EMAIL PROTECTED]
> > > Sent: Saturday, July 05, 2003 10:46 PM
> > > To: CF-Talk
> > > Subject: RE: Caching cfc objects in the application scope
> > >
> > >
> > > Right, good catch. I guess thats whats causing the error. But
> > > why should
> > > it? And why would it only cause an error sometimes?
> > >
> > > Brook
> > >
> > >
> > > >or i or something, just be sure to use a var statement as well.
> > > >
> > > >=============================================================
> > > ==========
> > > >=
> > > >===
> > > >Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
> > > >(www.mindseye.com)
> > > >Member of Team Macromedia
> > > (http://www.macromedia.com/go/teammacromedia)
> > > >
> > > >Email    : [EMAIL PROTECTED]
> > > >Blog     : www.camdenfamily.com/morpheus/blog
> > > >Yahoo IM : morpheus
> > > >
> > > >"My ally is the Force, and a powerful ally it is." - Yoda
> > > >
> > > > > -----Original Message-----
> > > > > From: Brook Davies [mailto:[EMAIL PROTECTED]
> > > > > Sent: Saturday, July 05, 2003 10:30 PM
> > > > > To: CF-Talk
> > > > > Subject: Re: Caching cfc objects in the application scope
> > > > >
> > > > >
> > > > > Hi Sean,
> > > > >
> > > > > The code (at line 78)  is inside a cfloop. Prior to the
> > > cfloop,  I
> > > > > initialize this local var (at the top of the method):
> > > > >
> > > > > <cfset var returnstruct=structnew()>
> > > > > <cfset  returnstruct.cleanedstring="">
> > > > >
> > > > > Then the cfloop looks like this:
> > > > >
> > > > > <cfloop from="1" to="#arraylen(descriptlistArray)#"  index="x">
> > > > >          <!--- convert the form element descript to an
> > array --->
> > > > >          <cfset x=listtoarray(descriptlistArray[x])>
> > > > >
> > > > >          <!--- more code here --->
> > > > >          Then comes line 78:
> > > > >
> > > > >          <cfset
> > > > > returnstruct.cleanedstring=listappend(returnstruct.cleanedstri
> > > > > ng,x[5])>
> > > > > </cfloop>
> > > > >
> > > > >
> > > > > It works about 99% of the time and maybe 1 out of 1000
> > times this
> > > > > code is executed it generates the error shown below. I
> > > included some
> > > > > of the other
> > > > > code so you could see that their is in fact an Array
> > > named "x" and a
> > > > > structure named returnstruct. What do you think?
> > > > >
> > > > > Brook
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > At 08:50 PM 7/5/2003 -0700, you wrote:
> > > > > >On Saturday, Jul 5, 2003, at 18:04 US/Pacific, Brook
> > > Davies wrote:
> > > > > > > You have attempted to dereference a scalar variable of type
> > > > > > > class java.lang.Double as a structure with members. <br>The
> > > > > error occurred
> > > > > > > on line 78.
> > > > > >
> > > > > >I'd be interested to see the code around line 78...
> > > > > >
> > > > > >Sean A Corfield -- http://www.corfield.org/blog/
> > > > > >
> > > > > >"If you're not annoying somebody, you're not really alive."
> > > > > >-- Margaret Atwood
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to