First question is data from your query. Does it have 6 rows or did you show some grouping already?
Yes, a query is already sorted by the field that will be used for grouping as in your example.
Is it possible that you write exact result set from your query and draw on paper how you want your report to look like and post photo?
I'll try to explain it another way, because I think I wasn't clear...
Starting from your query if I import these records in the report, there will be the assembly and page break using the X field in the GroupHeader and in the footer the current page and the total pages so far will be calculated without problems.
What I need is that: When generating the report, when there is a change in the value of field X from A to B, there is a reset of the total of Pages and the current page as in the example below...
Report:
ID 1
One
One
One
--- Footer: 1 Of 1
ID 2
Two
Two
Two
--- Footer: 1 Of 1
As in the example above, when there is a page break using the ID field, the PAGES and TOTALPAGES variables must be reset because in my situation it is generating and counting the total of pages: x of 2 pages