Script in After Rule check event handler fails after creating 100 empty table rows

Symptoms

When the script that adds rows to the table in the "After Rule check" event handler is used, it creates 100 empty rows all at once and then fails with "Error in After Rule check event: Stack overflow during script execution. Limit of 100 nested cells reached." message.

Cause

Rules are re-checked every time after there is any change in the document's fields. So when new row is added, the event is triggered and the script enters the infinite loop, until it reaches the limit of 100 cells.

Resolution

Please move the script into another event handler: "After document state is changed".

The inner script logic should be enclosed in the

if (ChangedStates.Has(2)||Document.IsRecognized) { ... }

condition, to ensure that it is applied only after Recognition to the recognized document.

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.