[Solved]Reset the cursor of a Query (resultset)

Caché

Hello,

 

First sorry for my english :)

 

I'm looking for a solution to reset the cursor of a query in a csp page.

In my code I do:

<csp:query name="users" classname="UserId" queryname="Find">
 <csp:while condition="users.Next()">
         ...
 </csp:while>

 

And 100 lines after I have to do exactly the same ...

Is it a way to do the while without do the query again ?

Something like users.Reset() ??

 

Thanks a lot for your help

 

Sébastien

 

 

Answers

You can't reset query, and loop again on the same result. You should execute as many as you need their results.

But I think you can store result somehow, to some you buffer, and use it in next time.

Thanks for your answer.

 

You absolutly right.

 

You cant directly save the request in a variable but you can create a classmethod that execute the query and return the resultset. And then you can save this return in a variable.

 

Thanks a lot Dmitry that save 10s of page load :)