3 Replies Latest reply on Mar 15, 2007 3:59 PM by Wrapper_Guy

    Displaying multiple pages

      I am executing a query that results in output that needs to be displayed over several pages. The DB has been furnished by my client who gets new updated copies of the DB periodically so I cannot modify the tables in the DB. They are simply to be replaced each time a new DB is furnished.

      The problem is that there is a column called 'Series' which has the same value for multiple part numbers (based on color or size) and my client only wishes to display one of the images associated with each 'Series' value. This part is not a problem.

      However, since I return many more records than will result in ouput, I have no way of knowing, in advance, how many records will be processed to result in the number of images established for each page. Thus, while I could pass the last record processed to the next page, I do not know what to pass if the viewer wants to go from page 1 to page 7, for example. And, I have no idea what value to set as the last value for a loop or output statement.

      Would processing the entire query at one time to extract all the displayable values and stuff these into an array be the appropriate approach and then just pass the start and end records of the array for each page or is there a more elegant way to do this?

      Does anyone have a solution to this problem?
        • 1. Re: Displaying multiple pages
          Dan Bracuk Level 5
          Processing the entire query at once is a good idea. Stuffing the data into an array is unnecessary. It is a lot less work to either cache the query or make it a session variable.
          • 2. Re: Displaying multiple pages
            Wrapper_Guy Level 1
            Hi Dan,

            Once again you demonstrate your mastery. To tell you the truth, I had not thought of processing the entire query and putting what I need into an array until I was composing my question. Since it was very late and I did not get any responses after an hour, I decided to try it. So, I wrote the code using the array approach and making it and several other variables session variables and it works great. The one benefit of creating the array is that I do not have to redo the processing of the array as the user changes pages and all I have to pass through is the current page number the user is viewing.

            Thanks again for your response.

            • 3. Re: Displaying multiple pages
              Wrapper_Guy Level 1
              Oops. I meant to say that the benefit of the array approach is that I do not have to reprocess the query info each time and it would still leave me with the dilemma of trying to figure out what info to pass so I did not have to refigure everything before the user could display the page wanted.