Here it is Dave,  I have only included the page that contains all of the cf
code that does any real work (not just formatting or which link to show
logic).  If you want more, I will be happy to provide it to you, but I will
let you know, as you can see by some of the statements, that I can verify
for a fact that the code that updates the Second Query (session.MyCat) does
not run twice (I am referring to the session.mycat.recordcount before and
after the update).  

I will give address of actual site for all those that are willing to help.

I have the same "<cfoutput>MyCat Length Before =
#Session.MyCat.recordcount#</cfoutput>" on an application.cfm page and a
OnRequestEnd.cfm Page.  Everything looks right when the record gets updated.
It is after all processing is done, the page has been returned its entirty
to the client, then on the following request the recordcount has increased
by one.  I don't understand how this can happen!!!

----------------------------CFScript.CFM (an included
page)----------------------------------------------------
<cfif IsDefined("ADates")>
        <cfquery datasource="#session.DB#" name="GetDates">
                Select * 
                From Schedule
                Order by ADate
        </cfquery>
</cfif>
<cfif IsDefined("Announcements")>
        <cfquery datasource="#session.DB#" name="GetAnn">
                Select * 
                From Announcements
                Order by AOrder
        </cfquery>
</cfif>
<cfif (IsDefined("URL.S"))>
        <cflock scope="SESSION" throwontimeout="Yes" timeout="2"
type="EXCLUSIVE">
                <cfset Session.Show = "#url.s#">
        </cflock>
        <cfset Redo = "Y">
        <cfif (Session.Show eq "L")>
                <cflock scope="SESSION" throwontimeout="Yes" timeout="2"
type="EXCLUSIVE">
                        <cfset Session.CurCatUrl = "Session.VideoCat">
                </cflock>
        <cfelseif (session.Show eq "N")>
                <cflock scope="SESSION" throwontimeout="Yes" timeout="2"
type="EXCLUSIVE">
                        <cfset Session.CurCatUrl = "Session.InternetCat">
                </cflock>
        </cfif>
</cfif>
<cfif (Not IsDefined("url.O"))>
        <cfset url.O = "LotNum">
</cfif>
<cfIf (Not IsDefined("url.R"))>
        <cfset Url.R = 0>
</cfif>
<cfif (IsDefined("url.P"))>
        <cfset Page = url.P>
<cfelse>
        <cfset Page = 1>
</cfif>
<cfif (IsDefined("url.PP"))>
        <cfset session.PerPage = url.PP>
        <cflock scope="SESSION" throwontimeout="Yes" timeout="2"
type="EXCLUSIVE">
                <cfIf (session.PerPage gt 0)>
                        <cfset session.NumPages =
Fix(Session.Catcount/Session.PerPage)>
                        <cfif (session.Catcount mod 10)>
                                <cfset session.NumPages = session.NumPages +
1>
                        </cfif>
                        <cfif (Page gt session.NumPages)>
                                <cfset Page = session.NumPages>
                        </cfif>
                <cfelse>
                        <cfset session.NumPages = 1>
                </cfif>
        </cflock>
</cfif>
<cfIf (IsDefined("SCat"))>
        <cfset url.Redo = "Yes">
</cfif>
<cfif IsDefined("Catalog")>
        <!---If there is a different Catalog request, Query DB and insert
into Session.QueryList--->
        <cfif (IsDefined("Redo"))>
                <cfstoredproc procedure="GetCat" datasource="#session.DB#">
                        <cfprocparam dbvarname="@Cat"
cfsqltype="CF_SQL_VARCHAR" value="#Session.Show#" type="In">
                        <cfprocparam dbvarname="@Order"
cfsqltype="CF_SQL_VARCHAR" value="#url.O#" type="In">
                        <cfprocparam dbvarname="@Region"
cfsqltype="CF_SQL_Integer" value="#url.R#" type="In">
                        <cfprocresult name="Variables.NewCatList">
                </cfstoredproc>
                <cfif Variables.NewCatList.recordcount neq 0>
                        <cflock scope="SESSION" throwontimeout="Yes"
timeout="2" type="EXCLUSIVE">
                                <cfset Session.QueryList =
Variables.NewCatList>
                        </cflock>
                                <cfif (not IsDefined("Session.MyCat"))>
                                        <cflock scope="SESSION"
throwontimeout="Yes" timeout="2" type="EXCLUSIVE">
                                                <cfset Session.MyCat =
QueryNew("#NewCatList.ColumnList#")>
                                        </cflock>
                                </cfif>
                                <cflock scope="SESSION" throwontimeout="Yes"
timeout="2" type="EXCLUSIVE">
                                        <cfset Session.CurList =
"Session.QueryList">
                                </cflock>
                                <cfset Page = 1>
                                <cflock scope="SESSION" throwontimeout="Yes"
timeout="2" type="EXCLUSIVE">
                                        <cfset Session.PerPage = 25>
                                </cflock>
                        <!-- <cfoutput>
                                #NewCatList.recordcount#<br>
                                #Session.queryList.ColumnList#
                                #Session.QueryList.recordcount#
                        </cfoutput>     
                        <cfdump var="#NewCatList#" expand="yes">
                        <cfdump var="#Session.queryList#" expand="yes"> -->
                </cfif>
        <!---Change output Query to Session.QueryList--->
        <cfelseif IsDefined("url.QL")>
                <cflock scope="SESSION" throwontimeout="Yes" timeout="2"
type="EXCLUSIVE">
                        <cfset session.CurList = "Session.QueryList">
                </cflock>
        <!---Add to Session.MyCat Query and set it as the Cat to Show--->
        <cfelseif IsDefined("url.mc")>
                <cflock scope="SESSION" throwontimeout="Yes" timeout="2"
type="EXCLUSIVE">
                        <cfset session.CurList = "Session.MyCat">
                </cflock>
                <cfif (IsDefined("url.L") and IsDefined("url.A"))>
                        <!--- Code that adds session.QueryList row to
Session.MyCat Query--->
                        <cflock scope="SESSION" throwontimeout="Yes"
timeout="2" type="EXCLUSIVE">
                                <cfoutput>MyCat Length Before =
#Session.MyCat.recordcount#</cfoutput>
                                <cfset tmp = QueryAddRow(Session.MyCat, 1)>
                                <cfloop
list="#Session.QueryList.ColumnList#" index="CN">
                                        <cfset TheValue =
"Session.queryList.#cn#[#url.l#]">
                                        <cfset tmp =
QuerySetCell(Session.MyCat, CN, Evaluate(TheValue),
Session.MyCat.RecordCount)>
                                </cfloop>
                                <cfoutput>MyCat Length After =
#Session.MyCat.recordcount#</cfoutput>
                        </cflock>
                </cfif>
        </cfif>
        <!---Set varibles for page movement--->
        <cfif (Session.CurList eq "Session.QueryList")>
                <cflock scope="SESSION" throwontimeout="Yes" timeout="2"
type="EXCLUSIVE">       
                        <cfset Session.CatCount =
Session.QueryList.recordcount>
                </cflock>       
        <cfelse>
                <cflock scope="SESSION" throwontimeout="Yes" timeout="2"
type="EXCLUSIVE">
                        <cfset Session.CatCount = Session.MyCat.recordcount>
                </cflock>
        </cfif>
        <cflock scope="SESSION" throwontimeout="Yes" timeout="2"
type="EXCLUSIVE">
                <cfset session.NumPages =
Fix(Session.Catcount/Session.PerPage)>
                <cfif ((session.Catcount mod 10) or (Session.NumPages eq
0))>
                        <cfset session.NumPages = session.NumPages + 1>
                </cfif>
        </cflock>
        <cfif (Page eq 1)>
                <cfset PPage = 0>
                <cfset StartLoop = 1>
        <cfelse>
                <cfset PPage = Page - 1>
                <cfset StartLoop = ((Page - 1) * session.PerPage) + 1>
        </cfif>
        <cfif (Page eq session.NumPages)>
                <cfset NPage = 0>
                <cfset StopLoop = session.CatCount>
        <cfelse>
                <cfset NPage = Page + 1>
                <cfset StopLoop = StartLoop + Session.PerPage - 1>
        </cfif> 
</cfif>

-----Original Message-----
From: Dave Watts [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, February 02, 2003 11:09 PM
To: CF-Talk
Subject: RE: Array and Query Length


> Can someone please tell me how an array or query stored
> in a session variable can be one length at the end of on 
> page, then another length at the top of the next page?
> 
> I have an array and query (tried same thing two different
> ways) with an arrayLen() and Query.Recordcount at the top 
> of an application page and the end of a OnRequestEnd page.  
> One row gets added to either just fine, but on the top of 
> the next page the array or query has ANOTHER row added two 
> it. Yes, a duplicate row, but after the page has been 
> returned to the client browser.
> 
> I have tested this on 2 CFMX boxes and one CF5 box, so I
> know that it is not a server issue. But, after having two 
> other people look at my code, and not being able to explain 
> how this is happening, I NEED HELP!!!
> 
> Anyone that is willing to assist, I will be greatly
> appreciative.

It sounds like the code that you think is supposed to run once, is in fact
running twice. You might want to post your code in its entirety here, and
see if anyone can help then. If you can build a simple test case (removing
any extraneous code that doesn't directly have to do with your problem),
that might also be helpful.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

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

Reply via email to