How to fill an empty table by script in the FlexiCapture 12

Question

How do I assign the data to an empty Table which I created in Project Setup Station?

The code below does not yeild any output:

IField newEmptyTable = Document.Field("DocumentDefinition1\\NewEmptyTable");
newEmptyTable.Items[0].Field("Field1") = "Sample Text";
newEmptyTable.Items[0].Field("Field2") = "Sample Text2";

Answer

Please create an "Items" instance in the empty table first before trying to fill it:

https://help.abbyy.com/en-us/flexicapture/12/developer/ifields - AddNew() method.

IField newEmptyTable = Document.Field("DocumentDefinition1\\NewEmptyTable");
newEmptyTable.Items.AddNew(0); //will add table row on the 1st position
newEmptyTable.Items[0].Field("Field1") = "Sample Text";
newEmptyTable.Items[0].Field("Field2") = "Sample Text2";

Please note, that the script dealing with these objects cannot be used in the script Rules and should be executed in a script stage or an event handler, e.g. After document state changed.

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