MarcomCentral (PTI) and FusionPro User Communities

MarcomCentral (PTI) and FusionPro User Communities (http://forums.pti.com/index.php)
-   FusionPro® VDP Creator (http://forums.pti.com/forumdisplay.php?f=5)
-   -   Complex Form Numbering Question (http://forums.pti.com/showthread.php?t=5398)

TroyM68 September 16th, 2019 03:49 PM

Complex Form Numbering Question
 
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!

Dan Korn September 17th, 2019 10:57 AM

Re: Complex Form Numbering Question
 
I'm not quite following how this is all put together. Posting a collected template would be helpful.

ThomasLewis September 17th, 2019 02:26 PM

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:

Code:

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.

TroyM68 September 26th, 2019 12:33 PM

Re: Complex Form Numbering Question
 
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.

TroyM68 September 26th, 2019 01:00 PM

Re: Complex Form Numbering Question
 
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!

TroyM68 October 17th, 2019 02:03 PM

Re: Complex Form Numbering Question
 
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!


All times are GMT -7. The time now is 06:47 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.