Community

Assembly Error

Hi,

I have a scenario where documents gets merge based on keyfield value.
In Assembly Tab I have enabled Custom script for assembly and used "AssemblingErrors.AddRedundantPageError( pageIndex );" if document is not supposed to get merge.

query -
Whenever that keyfield value is blank it throws an assembly error of -Incorrect page order. How to avoid this? Please suggests

Was this article helpful?

0 out of 0 found this helpful

Comments

9 comments

  • Avatar
    Timur
    Hello,

    Could you please attach a sample project for analysis? And provide a description of expected bahavior?


    Regards
    Tim

    0
  • Avatar
    Kalyani
    Hi, Please find the project in link attached.

    If you open the batch there is a cross mark on document.
    (As per my understanding -
    Key Field is "Invoice Number", which is blank, due to which that cross mark has appeared)

    Expected is -
    If above my understanding is correct, then how to avoid that cross mark?

    You can find the Assembly script in Assembly Tab - > Use Custom script for assembly - >

    Thanks,

    0
  • Avatar
    Timur
    Something is wrong with the link could you please provide a new link?
    0
  • Avatar
    Kalyani
    Hi,

    can this one. -
    https://www.dropbox.com/sh/rkni3t35021088i/AAAYEt2aLkjb5wLbibg2fHFYa?dl=0

    If its yet giving issues, provide me your id where I can mail you the project

    Thanks,
    0
  • Avatar
    Kalyani
    0
  • Avatar
    Timur
    Hello,

    I have downloaded project in the first link and tried to debug the script.

    It looks like there is an error present.

    This follwing check fails when processing document in the project

    if( field.Text != "" && field.Text.length > 2)

    So our pagesToMerge array is empty

    which means this variable: var pageIsValid = false; remains false and execution proceeds to the follwoing section:

    if( !pageIsValid)
    {
    AssemblingErrors.AddRedundantPageError( pageIndex );
    }

    This causes the error.


    Regards
    Tim





    0
  • Avatar
    Kalyani
    Yes, but if I remove that condition then pages get wrongly merged.
    It is analyzed that if page is not marked as invalid, i.e, if none of assembly errors are added then remaining successive pages get merged, it does not remain as single page.

    What I want is if key field is empty it should not exception/error.
    I have tried several conditions in if (!pageIsValid) loop, but no success.

    Thanks,

    0
  • Avatar
    Timur
    I think, in the final loop you need to check if a document is a one page document, in this case you probably dont need to check assembly errors since there cant be any

    Regards
    Tim
    0
  • Avatar
    Kalyani

    I tested the same, but if I put page count condition wrong merge happens.

    Basically, issue is if I don't assign Assembly errors to any page then that page gets wrongly merged with some other document.
    Without assembly error assigned page is treated to be mandatorily merged.
    0

Please sign in to leave a comment.