This provides a scrollable resultset object that can also be saved and loaded
It works by running the entire query when the first item of data is requested
and storing the results in a global. Then you can move around the results by setting the
Set results=##class(%ScrollableResultSet).%New("Classname:QueryName") Do results.Execute() Do results.Next() Write results.Data("fieldname") Do results.%Save() Set id=results.%Id() Kill results Set results=##class(%ScrollableResultSet).%OpenId(id) Do results.Next() Write results.Data("fieldname")
There is also a
Number of current row in the temp table, you can set this property to move to a new location and also use this to check the current position. If you specify a value that is out of bounds then the row will not be moved. The first row is at CurrRow=1, so it is 1 based and not 0 based.
This determines how many rows this query will load, the default '0' will load all the results, if you set it to 10,000 then it will only load the first 10,000 rows, which will mean you can not access any data beyond the 10,000th element. Also the actual stopping point may be slightly larger than MaxRows because of the way the data is imported, but it will be around this figure.
Returns the number of rows contained in this ResultSet.
This is a Set accessor method for the
If this query contains an object Id then this method opens an object with this Id and returns the object reference. Otherwise it returns a null object reference.
Advance the result set cursor to the next row. Returns 0 if the cursor is at the end of the result set.
Advance the result set cursor to the previous row. Returns 0 if the cursor is at the end of the result set.