Forum Documentation Showcase Pricing Learn more

Print Report with "Page X of Y"

I need to print a report of a Repeating Group that contains a Multiline Input Box/Rich Text Editor. This report is a contract that details the services my company is going to perform for a client. Because it is a contract, I need a text box that says “Page X of Y”. I’ve seen some solutions for this but they all involve RGs where each cell is the same height. In my situation, each cell of my RG is going to be variable height depending on the length of text typed into the multiline fields. My employees could write “Company will provide services to client” or they could write “Company will provided X, Y, and Z specific services with A, B, and C itemized details” and each client could have two or 100 different services with various amounts of text in each of those boxes. Does anyone have a recommendation for how I can print a report with this page number information?

While I’ve received no responses to this question, I did figure out a solution and wanted to share in case it helps anyone else.

I used @zeroqode’s Mouse & Element Positions plugin, specifically the the Query X/Y position action, to create page numbers for my variable-height repeating groups. I’m doing two things with this:

  1. Text on the first page to the effect of “this contract is Y pages long.” -
    This was fairly easy to achieve with the workflow to Query X/Y position. I put an invisible shape with a height of 1 immediately below my repeating group and used that to effectively query the rendered page height. I divided the result by the height of a standard page (1280 with my page margins at least) to get the total number of pages.

  2. Text on each individual page that says “page X of Y.”
    This was more complicated. A little background on my data. It is organized like this: A single Project has one or many Options and each of those Options have one or many Details (RTE/Multiline Input box that is specifically tailored to each Project depending on the scope of services we are providing).

To get make the report print page numbers on each page, I made a repeating group of my Current Page Project:converted to list and within that I placed two additional Repeating Groups. The first one is RG-Option and fills most of the page in width. The second one is narrow repeating group on the right side of my page that contains my Page X of Y textbox.

Some background on the data source of the second RG. I made a workflow that sets a custom state (Page Count) to the main RG-Project to a number equal to the total number of pages on the report as described in my first bullet point. Then I also created a new Data Type called Page Numbers that only has one field, a number field called Page Numbers. I filled that data table with manual New Entries of Page Number things 1, 2, 3, etc. So the data source for this RG-Page Number is Search for Page Numbers items until RG Project’s Page Count. And the data for the textbox within the RG-Page Number is Current Cell’s Index + 1 of RG-Project’s Page Count. I used the +1 because the first page is actually filled with boiler plate contract text (plus the text from the first bullet point, the total contract price, etc.).

A couple of more things about the the formatting of this: 1. The height of RG-Page Number is 1280, so that each successive Current Cell’s text box falls on the next page, but the height of its companion RG-Option and its parent RG-Project is only 120. This is because, again, my Details in the RTE could be one sentence (we’ll perform some work) or many sentences (we’ll perform A, B, and C detailed and itemized work) so I need to set the height to accommodate the least amount of data possible and have it auto-expand as necessary. The Parent RG-Project also has to match that height of RG-Option to avoid having unnecessary blank space on the last page. 2. And currently have the text Page X of Y showing at the top of each page, it didn’t seem to want to work as well at the bottom, but I may just need to play with it a little more.

Also, I wrapped RG-Option and RG-Page Number into the Parent RG-Project:converted to list even though there is always only one project per report because without that step it seemed RG-Option was always pushing RG-Page Number below itself and grouping them together helped them maintain their alignment. Perhaps I could have used a regular group? I don’t know, but it worked for me.

So anyhow, I hope all this detail helps someone else. And, again, thank you @levon for pushing the update to the Plugin that allowed me to do this.

1 Like

Thank you very much @accounting glad it helped!