OL Learn

Data Matrix - count to 999 then reset to 0

I need to add a datamatrix to each pdf page that contains number of sheets per pack (n of m) and a sequence number. I need the sequence number to start at 0 and count up by 1 for each page until it reaches 999. I will then need it to reset back to 0. I currently have multiple sections with different page numbers.

Below is what I’m currently using

${(‘0’ + sheet.nr).slice(-2) + (‘0’ + document.count.sheets).slice(-2) + (‘000’ + document.sequence.set).slice(-3);}

any ideas?

Hi Mark,

In the How-Tos section of this site Evie wrote a script that resets a counter. Just change 0 to 999 in the below line from the script.

var stepToReset = 0;

That is all I can think of as a quick solution for you. Might be something to build on.

EDIT: Added the link I forgot to add.

Regards,
S

thanks for this! perfect

You can skip the slice and use the number formatter of the output engine:

${((sheet.sequence.job+999-1)%999)+1,“000”}

This would count the sheets in a job from 001 to 999 over and over again.

regards -i.