is now part of CreativePro.com!

Creating Sequential Numbers for Data Merge… with a script!

9 0

Readers familiar with my articles will be aware that I have made InDesign’s Data Merge feature do some useful and sometimes unusual things, but the majority of my day-to-day work using Data Merge is sequentially numbered stationery.

The sequential numbers required for the stationery are typically prepared in a spreadsheet such as Microsoft Excel and then exported as a txt or csv file for use with the Data Merge palette. However, a free script called Indys Number Generator written by Stanislav Antos can create sequential numbers without having to open any spreadsheet software. The script has been available for some time but I feel it is a hidden gem and definitely worth discussing.

The script does have a list of its features on its website but unfortunately doesn’t feature a written how-to, and understanding some of the features can be a little confusing. So I’m taking it upon myself to explain it a bit.

The interface is split into three parts: Sequence, Member Format, and Output.

montage

More after the jump! Continue reading below
Free and Premium members see fewer ads! Sign up and log-in today.

Sequence

  • The first dropdown option (all integers) would fulfil the needs of most users. This creates a numerical sequence that increases by 1 and allows users to choose a start and finish number.
  • The arithmetic sequence allows the increment to be larger than 1 (for example, using a step value of 5 the number sequence 5, 10, 15, 20, 25… can be created).
  • The geometric sequence works differently – the number in the From field is multiplied by the Ratio field and then the next number in sequence is multiplied by the ratio field. For example, if the From number is 1, the To number is 4000 and the Ratio is 2, then the number sequence generated is 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048.
  • The random sequence is misleading. The From and To numbers here indicate the possible numbers that can be generated, but the count indicates the number of final records that will be produced. For example, if the From number is 1, the To number is 10 and the count is 3, then a number sequence of 2, 6, 7 is a possible result.
  • Integers selected from CSV file/texts selected from CSV file allow csv/txt databases created elsewhere to be manipulated using the Member format part of the interface.
  • At any stage, the sequences generated can be shuffled or randomised by clicking the Shuffle members checkbox.

Member format

  • The minimum length feature allows trailing numbers (or any character) to appear in the final result.
  • Numbers can be grouped so that a sequence that may appear as 000000000 can now appear as 000-000-000 – in this instance the numbers have been separated in groups of 3 characters using a dash separator.
  • Additional text before and after – a detail that could be typed in the data merge file itself, but is allowed for in this script.
  • Member separator – when using this for data merge, I would always leave this as paragraph. There are options such as new line (a soft return) but when using this script as a tool for Data Merge, there is no reason to change the default “paragraph”.

Output

  • The text can either be inserted into the document as a new text frame, or if a text frame is currently selected, can replace the contents of the text frame.
  • Typically the second option of saving as a CSV file is the one to choose for use with Data Merge. Click the create button to choose a file name and location, make sure that a header has been assigned and click OK. This creates the CSV file that contains the sequential numbers that can then be used in a Data Merge by opening the Data Merge palette, clicking the flyout and clicking Select Data Source…

I wish the script could automatically add the data file to the Data Merge panel for us (rather than us having to do it manually after creating the CSV containing the newly created sequence).

But other than that, I love this tool. It is definitely one of my go-to scripts.

By the way, there’s another, simpler, free script (called LotteryNumbers, from Loic Aigon at Ozalto) which purely creates sequences that increase by 1 and can contain trailing zeros (if required) — this is also great for most numbering purposes.

A prepress operator and graphic designer for a South Australian commercial printer, with close to 20 years of experience in the trade. He is also a regular contributor to this site and InDesign Magazine, and hosts his own prepress blog "Colecandoo".
  • gert says:

    I knew the lotteryNuembers script. I use it a lot. Easy and not failing. The one from Antos I didn’t knew. I’ll try that one out as well.

  • timothy says:

    Perhaps your explanation already addresses this, but I can’t see it. Is there any way this script can be used for printing multiple-up in numeric sequence? For example, if I’m running 1000 postcards 4-up (on 250 sheets). I need the 4 cards on page 1 to be numbered 1, 251, 501, 751; then the 4 cards on page 2 numbered 2, 252, 502, 752; etc., so that when the sheets come out of the printer and are cut into 4, I have a stack of 1-250, a stack of 251-500, a stack of 501-750 and a stack of 751-1000.

    Is this possible?

    • I understand what you are after and that is to have four piles of postcards in the stack so that once cut down, the four stacks can be put one on top of another and be in sequential order. This is commonly referred to as “cut and stack” imposition.

      Using this script… no. While I use the data merge feature of InDesign often, I avoid the “multiple records” feature, but I typically prepare one record on one page, output the resulting file to PDF and then let the imposing software take care of the page imposition. If page imposition software is something that you don’t have, there is an alternate technique that requires preparing one record on a page, and then using the multipageimporter2.5 script to import them onto a larger sheet. Here is the link to that article: https://colecandoo.com/2011/10/28/theres-more-than-one-way-to-cut-and-stack/

      Otherwise, the further alternative is to make a spreadsheet with four columns of numbers (1-250; 251-500; 501-750; 751-1000), set the postcards 4 up and use one column for one postcard, another column for another postcard, etc.

      • Jeanne Shibley says:

        We created a spreadsheet with numbers running in one column in 4-out number groups: 1, 251, 501, 751, etc. and use the multiple records set-up. Our recent challenge was to take that spread sheet and do the 4-out number groupings in threes for reverse collate 3-part NCR on a copier. Takes a bit of time to set up but worth it in the long run.

  • Greg Mouning says:

    FYI, there is a reference to the Jared Katz Numbering script which does “cut and stack” at the following weblink:

    https://creativepro.com/topic/cut-and-stack-script-problem

    • I’ve had a look at Jared’s script and while it provides “A” solution for Cut and Stack, it doesn’t provide “THE” solution for cut and stack. I say this because:

      * It isn’t using the Data Merge feature, it simply creates an array of numbers that is threaded through text boxes. For thousands of records, this can create ID files that are large and unwieldy.
      * If artwork is two-part (or more) NCR for example, the way the solution works assumes that the parts are identical… trouble is they may not be.
      * The solution assumes that the data is numbering only. It isn’t a solution for cut an stack projects that contain direct mail such as postcards.
      * The solution assumes that there is only one stack to cut, but really there could be dozens of stacks. Take a run of the numbers 1-10000 for example. Let’s say you get 4-up on a sheet and the biggest stack that will fit in the guillotine is 500 sheets. A true cut and stack solution will print on the first stack 1-500, 501-1000, 1001-1500, 1501-2000. Ideal because the numbers can be guillotined and placed back onto a pallet for its next process. It also means I can provide these numbers first to the client and then they can wait for the other numbers (in case they had run out of stock and were in a hurry for replenishment stock). The solution doesn’t do that – instead, the first 500 stack will have the numbers 1-500, 2501-3000, 5001-5500, 7501-8000. That means not only is placement back onto the pallet confusing, but the customer has to wait for the artwork to be completely printed before even getting the first half of numbers. True, I could run the script several times to get the appropriate stacks, but why should I if the script did what I wanted? Especially if there are hundreds of stacks to print?

      In a perfect world, cut and stack is largely controlled by a commercial printer’s RIP imposition software such as EFI Fiery or AGFA Apogee. However, I am aware that this software is out of reach of many people and do appreciate the lower tech ways of accomplishing the same task.

      That said, I am researching a lower-tech way of accomplishing this task in InDesign that will satisfy the requirements of the 4 issues I’ve addressed… just don’t expect it before Christmas 2015!

  • Daniel Philips says:

    Hi, this is a great write up. I am very new to InDesign and i print onto a range of products and my first order with sequential numbering came up (serial numbers), I have the template made in illustrator and i also have the numbers added (00001 on all of the art work). A friend told me InDesign has a function for automatically incrasing the numbers by 1 for each art work. I have 105 pieces per template, is there a way to import the design and then sort the number (already text edible) and then save as a pdf then send to print?

    • Daniel: InDesign doesn’t really do sequential numbering by itself… well, it does, but only through the paragraph numbering feature. You might be able to get it to work for serial numbers: https://creativepro.com/figure-numbering-in-indesign-and-cross-references-to-them.php

    • Yes, I’m a little confused by your brief too. The script that I describe here will create an array of numbers using any step value that it offers, including by 1 number each time. Whether you put the resulting list directly into InDesign as text, or indirectly using the Data Merge feature is up to you. Perhaps learn more about the Data Merge feature of InDesign itself – David Blatner has a great series on Lynda.com that will explain Data Merge much more than I can on this thread.

      That said, Illustrator has its own version of Data Merge… I think it is called “variables”… it differs in that it works with XML files rather than TXT… Illustrator is not my field of expertise so anyone that can add to this, feel free.

  • >