# Complex Form Numbering Question

## Recommended Posts

This may not be so complex for some of you, but I am having a hard time with it. Here is what I am trying to do.

I need some help with numbering a document. This document contains 4 versions of a college exam. Each exam is 14 pages within the PDF, so the total number of pages in this template is 56 pages.

On the first page of each exam is a space for the exam number, below that is the Test Form Number, which is static.

Something like this:

Page 1

Exam #: 0001

Test Form 1

Page 15

Exam #: 0002

Test Form 2

Page 29

Exam #: 0003

Test Form 3

Page 43

Exam #: 0004

Test Form 4

Then it cycles the Test Form numbers, but the exam numbering continues to escalate.

Page 1

Exam #: 0005

Test Form 1

Page 15

Exam #: 0006

Test Form 2

Page 29

Exam #: 0007

Test Form 3

Page 43

Exam #: 0008

Test Form 4

I was thinking about creating a data file that would include the number of exams the professor would like to create. That number would equal the variable “Exam #”. I know I can create a sequential numbering rule...but, how would I get that rule to work across the multiple Test Form Numbers (in this example 4 different test forms). Does anyone have any ideas on how to accomplish this? Please let me know, thanks!

##### Share on other sites

I'm not quite following how this is all put together. Posting a collected template would be helpful.
##### Share on other sites

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.

##### Share on other sites

• 2 weeks later...
Dan, I don't think I can post the actual documents for this one because it is live test data for a University. I will try to make something and post it if needed.
##### Share on other sites

Thomas, this seems to work great for the existing 56 page document. I changed it a little to be more flexible with the number of forms a professor uses and the number of pages in the exam.

var form = Math.ceil(FusionPro.Composition.currentPageNumber / Field('Pages per Form'));

var exam = (FusionPro.Composition.outputRecordNumber -1) * Field('Number of Forms');

return form + exam;

I think now the only things I need to figure out now is how to pad the exam number with zeros and how to get this to compose a certain number of exams. For example, if there are 120 students, then it composes 120 Exams (Exam # 0001 thru Exam # 0120.

Any ideas? Thanks!

##### Share on other sites

• 3 weeks later...

Please disregard the additional questions, I was able to figure them out. I changed the return line in the javascript to

return FormatNumber("0000", form + exam); this provided the padding I was looking for...then I opened my eyes when looking at the callback rules and found the Repeat Record Rule!

Everything is working perfectly now!

Thank You!

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×

• #### FusionPro.com

• MarcomCentral
×
• Create New...