Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > FusionPro® VDP Creator

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 26th, 2013, 01:52 PM
brightfish brightfish is offline
Junior Community Member
 
Join Date: Apr 2009
Posts: 23
Default Repeating Sequential Numbers

I'm sure there's an easy way to do this, but I can't seem to wrap my head around it...

I need to produce sets of sequential numbers. I have a series of prefixes (i.e. "R21-") that each have a different starting number (i.e. "2145") and a different number of sequential numbers needed for each prefix. The kicker is that I need each sequential number to repeat a different number of times for each prefix. For example, line item (prefix) 1, may need to repeat each number three times and would output like this:

R21-02145
R21-02145
R21-02145
R21-02146
R21-02146
R21-02146
R21-02147
R21-02147
R21-02147
...

I'm using the repeatrecordCount call in onRecordStart to specify the quantity of unique numbers for the set. I can't figure out how to get each of those unique numbers to repeat x number of times though.

Does that make sense?
__________________
-----
FusionPro VDP Creator 8.2.7
Running on Mac OS 10.8.5
Reply With Quote
  #2  
Old November 26th, 2013, 02:07 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: Repeating Sequential Numbers

Can you post a sample data file?
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #3  
Old November 26th, 2013, 02:12 PM
brightfish brightfish is offline
Junior Community Member
 
Join Date: Apr 2009
Posts: 23
Default Re: Repeating Sequential Numbers

Here's a sample of a few records...

(sorry, pasting the data didn't work. Here's a screen cap of it)



The quantity would be the number of unique numbers for that set. The repeat count is the number of times that each of the unique numbers needs to repeat.

(Go Tigers this weekend!)
Attached Images
File Type: png Screen Shot 2013-11-26 at 4.07.23 PM.png (14.7 KB, 15 views)
__________________
-----
FusionPro VDP Creator 8.2.7
Running on Mac OS 10.8.5
Reply With Quote
  #4  
Old November 26th, 2013, 02:59 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: Repeating Sequential Numbers

Well since you are also hoping for a Gamecock loss, I feel like I should probably lend my solution to you

First of all, since you are repeating each record by the quantity, and each of those record repeats gets repeated again, you need to set your repeatRecordCount equal to Quantity * Repeat Count.

Then you can create an array of ticket values using 2 'for' loops. The first to loop through the "Quantity" and the second (nested) to duplicate that value by the value of the "Repeat Count" field. This will give you a resulting array that is the length of "Quantity" * "Repeat Count".

Then you can name the text frame that you want the ticket numbers to show up in (something like "TicketNumber") and populate it from OnRecordStart by accessing the ticket values using the current number of repeats that FP has gone through (FusionPro.Composition.repeatRecordNumber). Remember that array positions start at 0 so you'll have to subtract one from that number.

So your OnRecordStart Rule would look something like this:
Code:
var tickets = [];

for (var i=0; i<Int(Field("Quantity")); i++){
    for (var n=1; n<=Int(Field("Repeat Count")); n++){
        tickets.push(Field("Prefix-FP") + "-" + (Int(Field("Starting Number")) + i)); 
    }
}

FusionPro.Composition.repeatRecordCount = Int(Field("Quantity")) * Int(Field("Repeat Count"));

FindTextFrame("TicketNumber").content = tickets[FusionPro.Composition.repeatRecordNumber-1];
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #5  
Old November 26th, 2013, 04:30 PM
brightfish brightfish is offline
Junior Community Member
 
Join Date: Apr 2009
Posts: 23
Default Re: Repeating Sequential Numbers

Thanks much for the help, Ste. I kept getting stuck on trying to use a separate sequential numbering rule. This makes much more sense.
__________________
-----
FusionPro VDP Creator 8.2.7
Running on Mac OS 10.8.5
Reply With Quote
Reply

Tags
numbering, repeatrecordcount, sequential

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:40 AM.


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