Jump to content

Sequential Number Print


Gearstudios

Recommended Posts

Ok. I have exhausted the search feature and I can't seem to figure out how to accomplish this without doing it manually with a spreadsheet.

 

I have a project where the job prints a sequential number starting at 1001 and ends at 1251. Then it will start again but the start number is 2001 to 2251 and so on till the last batch at 70001 to 70251. I know I can do this manually but I was trying to find a way to program it to print a batch then increment the next batch by 1000 and this would create the new start number in the sequence till it hits the last batch number.

Link to comment
Share on other sites

Someone else can probably post a cleaner way to do this, but I think this would work for you:

var chunkHeight = 251; // Number in a chunk
var rec = FusionPro.Composition.inputRecordNumber;
var batch = (rec%chunkHeight == 0) ? Math.floor(rec/chunkHeight) : Math.floor(rec/chunkHeight) + 1;
var chunkSeq = (rec%chunkHeight == 0) ? chunkHeight : rec%chunkHeight;

// Format chunkSeq and prepend batch number
var seq = batch + FormatNumber("000",chunkSeq);

return seq;

Edited by step
Added closing code tag
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...