Reputation: 297
I need to create some documents in Genexus indicating the number of pages for each document separately To clarify better, I need to create a 6-page report in which the first 2 belong to one document and the remaining 4 to another At the moment, thanks to the &Page variable and the {{Pages}} command (for which I can't find any documentation, I only know that it was suggested to me many years ago) I can indicate the ratio between the current page number and that of total pages
1 / 6
2 / 6
...
6 / 6
I would need though if there is a way to have a subtotal so that the two documents have the totals shown separately. I would like to get this type of numbering
1 / 2
2 / 2
1 / 4
2 / 4
3 / 4
4 / 4
I can manually reset the Page variable, but I don't know how to do it for the total number of pages, I can't even calculate it in advance. Is there a way to solve this, perhaps with other commands similar to {{Pages}} ? Where can I find documentation on these?
Upvotes: 1
Views: 79
Reputation: 108
If the row height is fixed, you can calculate the number of pages in advance because you will know how many rows will be on each page.
Upvotes: 0
Reputation: 297
Although not efficient, I found two solutions: one is to generate the files separately and merge them via a user control, another is to generate them separately as "temporary files", receive the length of the document as an output parameter (the &Page variable) and use this parameter as a total for the corresponding section. Then I delete the temporary file.
Pretty crude, but it worked
Upvotes: 0
Reputation: 292
You could try with auxiliar variables to keep the page count:
Before the print command add this code on Source:
If &Page <= 1
&TotalOfPages = 2
&CurrentPage = &Page + 1
Else
&TotalOfPages = 4
&CurrentPage = &Page - 1
EndIf
Then in the layout where you have
&Page of {{Pages}}
replace with:
&CurrentPage of &TotalOfPages
Upvotes: 0