brightfish Posted November 26, 2013 Share Posted November 26, 2013 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? Quote Link to comment Share on other sites More sharing options...
step Posted November 26, 2013 Share Posted November 26, 2013 Can you post a sample data file? Quote Link to comment Share on other sites More sharing options...
brightfish Posted November 26, 2013 Author Share Posted November 26, 2013 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!) Quote Link to comment Share on other sites More sharing options...
step Posted November 26, 2013 Share Posted November 26, 2013 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: 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]; Quote Link to comment Share on other sites More sharing options...
brightfish Posted November 26, 2013 Author Share Posted November 26, 2013 Thanks much for the help, Ste. I kept getting stuck on trying to use a separate sequential numbering rule. This makes much more sense. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.