MarcomCentral (PTI) and FusionPro User Communities Repeating Sequential Numbers
 Register FAQ Calendar Search Today's Posts Mark Forums Read

#1
November 26th, 2013, 12:52 PM
 brightfish Junior Community Member Join Date: Apr 2009 Posts: 23
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
#2
November 26th, 2013, 01:07 PM
 step Senior Contributor Join Date: Jan 2010 Location: Charlotte, NC Posts: 955
Re: Repeating Sequential Numbers

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

#3
November 26th, 2013, 01:12 PM
 brightfish Junior Community Member Join Date: Apr 2009 Posts: 23
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
 Screen Shot 2013-11-26 at 4.07.23 PM.png (14.7 KB, 16 views)
__________________
-----
FusionPro VDP Creator 8.2.7
Running on Mac OS 10.8.5
#4
November 26th, 2013, 01:59 PM
 step Senior Contributor Join Date: Jan 2010 Location: Charlotte, NC Posts: 955
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
Mac OS X 10.12

#5
November 26th, 2013, 03:30 PM
 brightfish Junior Community Member Join Date: Apr 2009 Posts: 23
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

 Tags numbering, repeatrecordcount, sequential