Community

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

Hi,

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.

Thanks

Was this article helpful?

0 out of 0 found this helpful

Comments

6 comments

  • Avatar
    Katja Ovcharova
    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.
    0
  • Avatar
    PhinkTad
    Thank you very much!
    0
  • Avatar
    PhinkTad
    Hi Katja,

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

    Thanks!
    0
  • Avatar
    Katja Ovcharova
    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;
    0
  • Avatar
    PhinkTad
    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?

    Thanks,

    0
  • Avatar
    Katja Ovcharova
    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.
    0

Please sign in to leave a comment.