Calculate amount in script in ABBYY Flexicapture

I would like to execute the function of the Calculate Sum rule with the Script rule in ABBYY Flexicapture, because I want to perform only the calculation based on the evaluation of the if statement.

I tried the following in a C # Script rule:

IFields AllTaxes = Context.Field("cu_location_taxes").Rows;

which gives me the error "Field is not a table".

I also tried

IFields AllTaxes = Context.Field("cu_location_taxes").Children;

which gives me the error "Unable to access fields not specified in the rule settings." Although I have added the repeating cu_location_taxes group to the C # Script rule.

As soon as I can get them in some variable of an array or list or IFields, I would like to somehow summarize the values ​​of children. I am open to this with JScript or C #.

+4
source share
1

, , ABBYY FlexiCapture. IField :

. . .
, , "cu_location_taxes" . , .

- ( ). script . , , script.

Items , .

, , field_1 _2. field_1. (JScript):

sum = 0
for (i = 0; i < this.Field("field_1").Items.Count; ++i)
{
    sum += this.Field("field_1").Items.Item(i).Value
}

field_1 . , .

+4

Source: https://habr.com/ru/post/1544526/


All Articles