We have some code in our report-viewing window to determine whether VCR-like paging controls (for First, Previous, Next or Last Page) are enabled based on whether there are multiple pages.
However, one of our reports has grouping, with Group 1 having the ResetPageCount property set (resets the page number at each group break).
So what that means is that in some cases, the report might just contain two pages, each of which is "Page 1 of 1".
In that situation, I don't know how to tell whether there are multiple pages in code. I thought maybe if ResetPageCount could be turned off in the code (if it's currently on), then get the PageCount, then turn it on again, I could solve the problem, but ResetPageCount seems to be a source code only property.
The code I'm currently using to determine whether to enable the VCR buttons is like:
Long ll_rowcount, ll_PageCount, ll_LastRowOnPage
Boolean lbEnabled = TRUE
ll_rowcount = dw_report.RowCount()
ll_PageCount = Long ( dw_report.Describe("Evaluate('PageCount()'," + String( ll_rowcount ) + ")"))
ll_LastRowOnPage = Long(dw_report.Object.DataWindow.LastRowOnPage)
if ll_rowcount = 1 or (ll_PageCount = 1 and ll_rowcount = ll_LastRowOnPage) then
lbEnabled = FALSE
end if
If we are sitting on the 2nd page (which still gives an evaluation of PageCount() as 1) this sets lbEnabled to FALSE. (And yes, there's a reason, which isn't relevant to explain, why we might be on the 2nd page when running this.)
Ideas? Thanks.
Wouldn't it be nice if the Help on the PageCount() function and the ResetPageCount setting had references to this function?