Community

How to delete a page in document which contains a particular type of barcode ?

I am using flexicapture 12, and want to delete a page which contains patch code but this needs to be done using script.

I tried to use  page.Picture.AnalyzePageObjects()  but that does not have any method to read the barcode type.

 

Was this article helpful?

0 out of 0 found this helpful

Comments

10 comments

  • Avatar
    Tatiana Dyu

    Hello Barkat,

    You are correct. With the script, it is not possible to get the barcode type.

    I can suggest you the following approach:

    • set up flexilayout/document definition to capture the patch code as a field
    • in the Advanced Workflow create a script stage (Automatic type) after the Recognition stage where you would check if the barcode field has been matched, if yes, then on what page of a document its region is located, and then delete this page.
    0
  • Avatar
    Barkat Bashir

    Hi Tatiana , Thank you for the response. 

    We have an unstructured document, as per my knowledge for unstructured we don't use flexilayout. 

    Still i tried to go through the flexilayout and what i found is there we can search for barcode which is fine, but the problem is we cannot search for a particular type of barcode. 

    In our document there are multiple barcodes and We have to get hold of the page which contains Patch code type of barcode and delete that.

    0
  • Avatar
    Tatiana Dyu

    Hi Barkat,

    You can specify to search only for the Patch code in the Barcode element properties:

    0
  • Avatar
    Barkat Bashir

    Hi Tataina , Thank you for the response. 

    Giving it a try now.

    0
  • Avatar
    Barkat Bashir

    Hi Tatania ,

    gave it a try and created the layout but since the project is unstructured I did get the option to add the layout in the project set up station. 

    0
  • Avatar
    Tatiana Dyu

    Hi Barkat,

    If you go into the section properties > Flexilayout tab, you should be able to load flexilayout:

    To be on the safe side, please do and test all the changes in the copy of the project (if it is in production).

    0
  • Avatar
    Barkat Bashir

    Hi , Tatiana ,  Thank you for the response.

    will give it a try now.

    0
  • Avatar
    Barkat Bashir

    Hi Tatiana, thank you for the above advice.

    now when i use Context.Feild("patchcode").isMatched , it returns me true , but this i could do in a rule inside the document definition. 

    I use the below code snippet to delete empty pages , can you help me with the patchcode code snippet. How do we search for patchcode on a page in a multipage document.

     

    0
  • Avatar
    Tatiana Dyu

    Hi Barkat,

    the sample code is the following:

    foreach (IDocument document in Batch.Documents)
    {

        if (document.Field("sectionName\\PatchCode").IsMatched && document.Field("sectionName\\PatchCode").Regions.Count > 0)
        {
         
            IPage pageToDelete = document.Field("sectionName\\PatchCode").Regions[0].Page;
            Batch.DeletePage(pageToDelete);
        
        }

    }
    0
  • Avatar
    Barkat Bashir

    HI Tatiana, Thank you for the response.

    Will give it a try using the code snippet provided.

    0

Please sign in to leave a comment.