Displaying next set of results in dsp page

Hi,
How can I get the results returned from a service in a DSP page to display only a limeted number of results and be able to go to the next set of results on a next page, i.e like a resultset or recordset in other dynamic pages.

Please help.

Thanks
Saritha

Hi,
How can I get the results returned from a service in a DSP page to display only a limeted number of results and be able to go to the next set of results on a next page, i.e like a resultset or recordset in other dynamic pages.

Please help.

Thanks

sarithawm,
Im not sure what exactly what you wanna do…
so ill just pitch in a couple of ideas…

#1…if u are wanting to display a certain set of results on one page and another set on another page…you could use ifvar/switch (page 15 on DSP Tutorials) and then filter out the results based on the conditions and display them on one page and the rest of the results could go on another output template…

#2 You could make your output template to display only ( lets for instance take 20 results per page) and display the rest of te results on the second output template page.

I really hope this helps…
scoobydoo

Scooby,

Can you plz elaborate on how one can display the results of a service over several pages by filtering them within the DSP. I understand the use of ifvar, but where would you hold the results that are yet to be displayed. That could be something very useful.

Saritha,
From what I could think - in order to split the results returned by a service and display only a fixed number at a time, you could create multiple DIVs in your output template/DSP, such that each DIV contains that fixed number of results. Then use the “Next” or numbered links to hide the current and display the next div. Not a very nice way of doing it - as your DSP could get heavy if the result set is large (which it probably is - requiring you to display results over multiple pages), but it gets the job done.

Another way seemingly possible is to design your service in such a way, so that it returns you only a set of results at a time. This way, in each call to your service, you may pass some parameters from your DSP that tell the service which set of results to get next. Using tn.query:documentQuery allows you to use enumeration. Though I haven’t used the enumeration (disablePaging=false), but believe it allows you to take the id of the enumeration and loop over it multiple times - each time, returning a set of results.

HTH, Rohit

Hi Scooby and Rohit thank you very much for your reply.I am querying a table and displaying the results in a dsp page.I want to design my dsp page so that i can diplay the query results in different pages if the results are too many for example if the query results 1000 rows i want to display 100 for each page with next and previous options.Also Instead of querying the database for all the results i want to query it each time when u hit the next and previous button…Any help plz

Thanks a lot

Taurean,SarithaWM,
Ok here is what i would think about doing if i were in your boots:
I realy hope it works for you

==========
#1.Check how many records the output consists of
#2.If result records exceed 100…
#3. Redirect the output to another dsp page by providing a link in the current DSP page…
For redirection I suggest you refer to JSP/ASP document which will tell you on how to do that…cant tell u off my mind…i would look around too if i were facing the same issue…
scooby
PS: Anyone else wanna jump into this thread?

Scooby.

Thanks for your reply… even though I am not looking to implement any such solution as of now… but this would be one of those ‘good to know’ things. Alright… agreed, one can redirect from one html page to another… and because we are using DSPs we can put the redirect code with the %ifvar%, but the problem still remains… how does the next dsp split these ‘more than 100 results’ into more than one dsps? Lets say we have 500 results… this would mean that we need 5 pages… each with 100 results. How would these 5 pages be generated once the called service has returned the 500 results?

Thanks, Rohit

I ended up creating a couple of java services to achieve pagination for DSPs - have posted the approach in this thread.

Rohit