How to delete empty rows from the table

Question

How can the rows with empty Fields be removed from the results?

Answer

The possible methods are as follows:

  • Create a FlexiLayout and export only the required information from the table using the Repeating Groups: FlexiLayout: Capturing a table using Repeating Group
  • Use a Custom Scripting Stage (Processing Script) in the Workflow or Event Handler Script to remove empty rows. This stage can be created after the Recognition stage if you have a completely empty row of the table, but it may be used after the Verification stage as well. You may refer to a sample C# script below which removes a row from the table if it has an "EmptyFieldName" field with an empty string value. Please mind, that it's not ready to use solution, so you'll need to customize it according to your needs for your project.
    string table = "Document Section 1\\Table";
    int rowCount = Document.Field(table).Items.Count;

    for (int i = 0; i < rowCount; i++){
        if (Document.Field(table).Rows[i].Field("EmptyFieldName").Text == ""){
            Document.Field(table).Rows.Delete(i);
    rowCount -= 1;
        }
    }
  • Create a Custom Export Script in Document Definition -> Export Settings -> Export Destinations, where it is possible to describe how documents should be exported, and the empty rows can be deleted during the export:

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.

Recently viewed