Gearstudios Posted January 24, 2014 Share Posted January 24, 2014 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. Quote Link to comment Share on other sites More sharing options...
step Posted January 24, 2014 Share Posted January 24, 2014 (edited) 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 January 24, 2014 by step Added closing code tag Quote Link to comment Share on other sites More sharing options...
Gearstudios Posted January 24, 2014 Author Share Posted January 24, 2014 (edited) WOW, that works. Only thing is how to format the first 9 batches to have a leading zero like 01001 and 02001 and 03001 etc. till it hits 10001? Edited January 24, 2014 by Gearstudios Quote Link to comment Share on other sites More sharing options...
step Posted January 24, 2014 Share Posted January 24, 2014 Edit the 'var seq' line to look like this: var seq = FormatNumber("00",batch) + FormatNumber("000",chunkSeq); Quote Link to comment Share on other sites More sharing options...
Gearstudios Posted January 24, 2014 Author Share Posted January 24, 2014 Thanks! That worked perfect. 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.