Barcode value as filename - not available when separation is not used

  • Last Post 24 June 2016
PhinkTad posted this 24 February 2016


The option to use the barcode value as filename works only when the barcode is used to separate the pages.
How to enable the barcode value to be used in output filename when no separation is used?
Does it need to be scripted?
If so, any samples will be appreciated.


Order By: Standard | Newest | Votes
Katja Ovcharova posted this 28 March 2016

Hello PhinkTad,

Indeed, the element in the file naming scheme can contain a barcode value only if the “Use barcodes to separate documents” option is selected in the workflow settings.
In other cases you need to access the barcode value in script (via BarcodeBlocks) and insert it into the , then specify as a part of the file name on the Output tab.

The CustomText can be defined at the following stages:
- in the Document separation script (Workflow properties > 3.Document separation tab)
- or in Document identification and indexing script (Workflow properties > 5. Indexing tab).

In the first approach the script will not be triggered if you set Create one document for each file in job in the document separation options. For other separation types it should be run and you can use code like this:

if (BarcodeBlocks.Count > 0)
CustomText = BarcodeBlocks.Item(0).Text;

If you are using indexing stage to define CustomText, then you should create at least one document type and then write the script like:

if (Pages.Count > 0)
if (Pages.Item(0).BarcodeBlocks.Count > 0)
CustomText = Pages.Item(0).BarcodeBlocks.Item(0).Text;
SkipManualIndexing = true; //keep this if you do not need to send the document to the Indexing station for manual indexing

Hope this information will be helpful.

PhinkTad posted this 13 April 2016

Thank you very much!

PhinkTad posted this 07 June 2016

Hi Katja,

I have a document which has two barcodes in one page. How do I access both of them as indexing variables?


Katja Ovcharova posted this 08 June 2016

Hello PhinkTad,

You can get any barcode on the page using the BarcodeBlocks.Item both in Document separation and Document identification and indexing script. There you can access barcode type, text and region, as described in Help.

Please see the sample code below:

CustomText = "";
for (var i = 0; i < pages.count;="">
//iterate all barcode blocks found on the current page
for (var j = 0; j < pages.item(i).barcodeblocks.count;="">
//use barcode text
CustomText += Pages.Item(i).BarcodeBlocks.Item(j).Text + "_";
if (CustomText == "")
CustomText = "NoBarcodes";
SkipManualIndexing = true;

PhinkTad posted this 23 June 2016

Hi Katja,

Thanks for the sample code. I have a follow up question...

In my workflow, all the documents have two barcodes. How do I send a task to exception if one of the barcodes is not found?


Katja Ovcharova posted this 24 June 2016

Dear PhinkTad,

To send a job to Exceptions you can check the number of barcodes found and if it is less than 2, then set
DiscardJob = true
This property is available at the Document separation and Document indexing stages, please see RS Main Help for more details.