Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Reset page count on repeating subform

Avatar

Former Community Member

I have a repeating subform that has some repeating pages.  The base subform is 8 pages, with

*the first 2 being a letter, these are not included in total page count

*the 3rd page is always marked page i, this is not included in total page count

*the 4th page needs is always page 1, this is the start of total page count

*the 5th can repeat 1 to n

*the 6th can repeat 0 to n

*the 7th can repeat 1 to n

*the 8th has a single instance. and should end the total page count for the form

I have a label at the bottom left that lists "Page x of y", this works great as long as there is only one instance of the report, but there are going to be up to 150 reports per file generated.  When I have multiple instance of the report I can't get the page count to reset starting at the 4th page.

I have played with the pagination options  of the subform but all I get are extra instances of the pages and no resolution of my problem.

Not sure my explanation is helpful but if anyone has any ideas please let me know.

If you want I can send a copy of the form and the XML to populate a single and multiple instance of the form.

Thanks

Cameron

1 Accepted Solution

Avatar

Correct answer by
Level 10

This is not so simple, but also not to difficult.

You need an individual script for each page.

The script does the following:

Summarize the number if instances of the previous pages together with the current instance number of this page

Page 2:

$ = Report.Page2.index + 1

Page 3:

$ = Sum(Report._Page2.count, Report.Page3.index + 1)

Page 4:

$ = Sum(Report._Page2.count, Report._Page3.count, Report.Page4.index + 1)

Page 5:

$ = Sum(Report._Page2.count, Report._Page3.count, Report._Page4.count, Report.Page5.index + 1)

Page 6:

$ = Sum(Report._Page2.count, Report._Page3.count, Report._Page4.count, Report._Page5.count, Report.Page6.index + 1)

View solution in original post

6 Replies

Avatar

Level 10

Hi,

you need to add a single count for each body page.

I designed a sample for you.

It has two body pages (PageA & PageB).

Each body page has a own counter display to show the current instance and the number of instances of it.

Instance counter:

this.rawValue = PageA.instanceIndex + 1;

Occurrence counter:

this.rawValue = PageA.instanceManager.count;

https://acrobat.com/#d=N2YtptDipOHBHdT5445RWg

Avatar

Former Community Member

I should have explained better, what I have is a subform that containes 8 subforms.  I was trying to set up some sort of counter but couldn't get it right.

The structure is as follows

Report

     Letter1

     Letter2

     Page1

     Page2

     Page3

     .

     .

     Page4

     .

     .

     .

     Page5

     .

     .

     Page6

/Report

Report

.

.

.

/Report

The 2 letters do not add to the page count.  Page 1 does not add to the page count and is marked in the lower left as "Page i".  Pages 2 through 6 add to the total page count with pages 3,4 & 5 being repeating pages.  I am assuming some sort of global counter on the Report sub form, I just haven't got it figured out.

I should mention that it works great as long as there is only one report, it is when multiple reports exist that the currentPage and pageCount don't reset for the new instance, this is why I was playing with the pagination settings.

Avatar

Former Community Member

I can send my files to anyone that wants them if what I am saying is unclear.   I don't have anywhere online to store the files for public consumption

cameron.kaley@ibridgegroup.com

Avatar

Level 10

You only need to count the number of instances of all pages you wanna have in your page count.

Use this FormCalc script in the layoutReady:event of a text field:

$ = Sum(Report._Page2.count, Report._Page3.count, Report._Page4.count, Report._Page5.count, Report._Page6.count)

This script returns the sum of all occurrences of the Pages 2 - 6 in the report, for example.

Avatar

Former Community Member

That worked great for fixing the total pages within a given Report.  Now the only issue is knowing a pages place within a Report. On the second instance of a Report Page2 shows up as Page 11 of 8.  There are 8 pages in the "Report" so the last number is correct but the 11 is where the page falls within the total document made up of multiple reports, does that make sense?  Either way I am trying to get figure out the proper syntax of how to get Report[i].currentPage. 

Thanks

Avatar

Correct answer by
Level 10

This is not so simple, but also not to difficult.

You need an individual script for each page.

The script does the following:

Summarize the number if instances of the previous pages together with the current instance number of this page

Page 2:

$ = Report.Page2.index + 1

Page 3:

$ = Sum(Report._Page2.count, Report.Page3.index + 1)

Page 4:

$ = Sum(Report._Page2.count, Report._Page3.count, Report.Page4.index + 1)

Page 5:

$ = Sum(Report._Page2.count, Report._Page3.count, Report._Page4.count, Report.Page5.index + 1)

Page 6:

$ = Sum(Report._Page2.count, Report._Page3.count, Report._Page4.count, Report._Page5.count, Report.Page6.index + 1)