View Single Post
Old September 17th, 2019, 02:26 PM
ThomasLewis's Avatar
ThomasLewis ThomasLewis is offline
Senior Contributor
Join Date: Feb 2011
Posts: 211
Default Re: Complex Form Numbering Question

It looks like the only thing that is really variable is the Exam #.

You could create a rule that is put in a text frame on each page that looks something like this:

var form = Math.ceil(FusionPro.Composition.currentPageNumber / 14);
var exam = (FusionPro.Composition.outputRecordNumber -1) * 4;
return form + exam;
It will output just the Exam # as you iterate through each version. It is important to check the box that says "Re-Evaluate this rule for every text flow" so it will properly get the page number.

Basically what's happening here is you are getting the page number the text frame is on and dividing by 14. So page 8, for instance, would be 0.57 and then rounding that up to a 1. Page 15 would be 1.07, rounded up to 2. That takes care of your forms in the 56 page template.

Next you need the exam number but that will continue to iterate up as you go. The outputRecordNumber will keep count of that. If you start that count off with 0 instead of 1, you can multiply that by 4 to get the iteration to go up by 4 for each record. ie record 1 = 0 (0*4 = 0), record 5 = 16 (4*4 = 16), then you add the form number, making record 1 = 1-4, record 5 = 17-20, etc.
Reply With Quote