Hi!
I use ScrollableResultSet class in this case.
This class is enable to use Previous() method, and it's able to reset Cursor by using repeatedly.
Like this.
Set query = "YOUR SQL"
Set result = ##class(%ScrollableResultSet).%New("%DynamicQuery:SQL")
Set sts = result.Prepare(query)
If ($$$ISERR(sts)) {
// ERROR
}
Do result.Execute()
If (result.%SQLCODE < 0) {
// ERROR
}
// Show get column data.
While (result.%Next()) {
Wrtie result.%GetData(1)
}
// Reset cursor index.
While (result.%Previous() > 0) {
// Do nothing.
}
// Show get column data again.
While (result.%Next()) {
Wrtie result.%GetData(1)
}- Log in to post comments
.png)
.png)
.png)
.png)