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").Text = "Sample Text";
newEmptyTable.Items[0].Field("Field2").Text = "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.

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.