Datamatrix Add a Variable to Additional Contents Output Creation Settings

I have constructed the string required to generate my Datamatrix barcode. I am stuck on creating a digit that will represent the first digit in the string.

The first digit needs to be a 2 on the first page of a document, a 1 on the last page of the document, and a 0 on all pages in-between.

This creates a 1 or a 2 but I don’t know how to make it a 0 on all pages in-between

${var w = (page.nr == 1) ? ‘2’: ‘1’; w;}

Thoughts?

${var w = (page.nr == document.count.pages) ? ‘1’: (page.nr == 1) ? ‘2’ : ‘0’ ; w;}

1 Like

Thank you so much for the response. I cut and past the expression you recommended . I am getting a parse error in column 47 (near ‘’'). It feels so close.

${var w = (page.nr == document.count.pages) ? ‘1’: (page.nr == 1) ? ‘2’ : ‘0’ ; w;}

04%20AM

Use double quotes instead of those funky single quotes that the web page used.
${var w = (page.nr == document.count.pages) ? "1": (page.nr == 1) ? "2" : "0" ; w;}

1 Like

You guys are the best!

That works great, thanks for the assist!!