I have a session with 500 records from a query. When a user is viewing
record 49X I want to run another query and get the next 500 and append it to
the existing session allowing them to continue moving back and forth through
the records. Then repeat the process if they are viewing record 99X and so
on.

Would I use StructAppend? In the help file it looks like this will just
append Columns and not Records.


Here is my code (I just wrote most of it in this email)


<cfquery datasource="#UserDatabase#" name="QryGetMessages">
 SELECT TOP 500 InboxID, InboxMessageGUID, UID, DateSent, MessageFrom,
FromName, MessageTo, Header, Subject, Body, CC, 
 MessageREAD, ReadDate, DateRead, ReplyTo, Replied, ReplyDate, UserGUID,
AttachDIR, Attatchments
 FROM Inbox
 </cfquery>

<cfparam default="500" name="MaxRecords">

<cflock type="EXCLUSIVE" scope="SESSION" timeout="10">
<cfscript>
        Session.QryGetMessages = StructNew();
        Session.QryGetMessages = QryGetMessages;
        Session.RecordCount = QryGetMessages.RecordCount;
      Session.MaxRecords = MaxRecords;
        Request.RecordCount = QryGetMessages.RecordCount;
        Request.QryGetMessages = Duplicate(Session.QryGetMessages);
</cfscript>
</cflock>



I have a StartID that tells what records to display in the output. 

So I ad to the StartID

<cfset MaxCheck = #StartID#+10>
<cfif MaxCheck GT Session.MaxRecords>

   Now I want to run the query and append it to the existing Session.
  
  <!--- Get the Max InboxID This is the Autonumber Feature in Access --->
        <cfquery dbtype="query" name="QryGetMaxInboxID">
        SELECT MAX(InboxID) as MaxInboxID
        FROM Request.QryGetMessages
        </cfquery>
 
   

 <cfquery datasource="#UserDaabase#" name="QryGetMessages2">
 SELECT TOP 500 InboxID, InboxMessageGUID, UID, DateSent, MessageFrom,
FromName, MessageTo, Header, Subject, Body, CC, 
 MessageREAD, ReadDate, DateRead, ReplyTo, Replied, ReplyDate, UserGUID,
AttachDIR, Attatchments
 FROM Inbox
WHERE InboxID > #QryGetMaxInboxID. MaxInboxID
 </cfquery>

<cfset MaxRecords = #MaxRecords#+500>

<cflock type="EXCLUSIVE" scope="SESSION" timeout="10">
   <cfscript>
        Session.QryGetMessages2 = StructNew();
        Session.QryGetMessages2 = QryGetMessages2;
        Session.RecordCount = QryGetMessages2.RecordCount;
      Session.MaxRecords = MaxRecords;
        Request.RecordCount = QryGetMessages2.RecordCount;
        Request.QryGetMessages2 = Duplicate(Session.QryGetMessages2);


So how do I join this session with the one above?


   </cfscript>
</cflock>

</cfif>


Thank you

Rick
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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

Reply via email to