OL Learn

Wrap around sequence - so close!

I’m using this code, that I nicked from another post:

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

This starts the code at 001 and runs to 999 then back to 001.

I need the code to start at 000 and run to 999 what do I need to change?

try
('000' + ((sheet.sequence.job-1)%1000)).substr(-3)

Hi Johndoe

I’ve tried this and cant quite get to work, have tried:

(‘000’ + ((sheet.sequence.job-1)%1000)).substr(-3)
$(‘000’ + ((sheet.sequence.job-1)%1000)).substr(-3)
$(‘000’ + ((sheet.sequence.job-1)%1000)).substr(-3);
${((‘000’ + ((sheet.sequence.job-1)%1000)).substr(-3)}
${((‘000’ + ((sheet.sequence.job-1)%1000)).substr(-3)};
$(‘000’ + ((sheet.sequence.job-1)%1000)).substr(-3)

I either get the above encode in the barcode as in (‘000’ + ((sheet.sequence.job-1)%1000)).substr(-3) is the data in the barcode and not the data I want or an error like this:

LoggedApplicationException: There was an error running the output creation process caused by There was an error initiating to the output creation process caused by ApplicationException: Unable to create text expander for ${((‘000’ + ((sheet.sequence.job-1)%1000)).substr(-3)}
ApplicationException: Unable to create text expander for ${((‘000’ + ((sheet.sequence.job-1)%1000)).substr(-3)}
(SRV000041)

{“error”:{“status”:500,“message”:“LoggedApplicationException: There was an error running the output creation process caused by There was an error initiating to the output creation process caused by ApplicationException: Unable to create text expander for ${((‘000’ + ((sheet.sequence.job-1)%1000)).substr(-3)}\nApplicationException: Unable to create text expander for ${((‘000’ + ((sheet.sequence.job-1)%1000)).substr(-3)}\n (SRV000041)”,“parameter”:""}}

@Barryosborne, please note that you can format date and number values. Search on the following page for “Formatting date and number values”: ‘Print output variables - PlanetPress Connect 2020.2 User Guide’

A option is to use one of the following:

  • ${sheet.sequence.job-1,000}
  • ${(sheet.sequence.job > 0 ? (sheet.sequence.job - 1) : 0),000}

Thanks Marten,

Both of these padded the number and started at 000 but it keeps counting past 999, I need it to get to 999 and then loop back to 000, 001, 002.

Thanks,

Here you are:
${((sheet.sequence.job-1)+1000)%1000,000}

This results in the following:
Page 1: 000
Page 100: 099
Page 1000: 999
Page 1001: 000
Page 1002: 001

and so on…
best regards
-i.

1 Like

Happy days that worked like a charm!