Creating a rule in FC 11 Document Definition that multiplies Quantity with Unit Price in Tables

  • Last Post 31 August 2017
  • Topic Is Solved
Mustafa_N097 posted this 07 August 2017

My firm is an Abbyy VAR and I am designing Layouts in FLS and then modifying Document Definitions in FlexiCapture 11 to eventually capture vendor invoice data for our customers (Country: United States).

Almost in all vendor invoices, there is a line items table with Quantity (shipped, sold, etc) and Unit price, whose multiplication gives Extended Price (or Amount), except for any deductions such as line item discounts or line adjustments.

I would like to ensure that line items table data is correctly recognized. Thus, I will need to create a rule that checks if Qty * Unit Price equals Extended Price. If the recalculation is correct, no changes will be made for that table row. If not, I want Extended Price column to be replaced by the recalculated Extended Price amount, if not, be written into a read-only control column that will be used to compare with Extended Price and to be summed up for being written into another field in Document Definition.

Right now, I have a rule that sums up all values in Extended Price Column, and compares a recalculated total with 'Invoice Total' cell data, after adding all other charges (i.e Sales Tax, Freight). Functionality of this rule depends on Extended Price Column to be recognized correctly. So I need to make sure Extended Price is recognized correctly, if not, force a rule to recalculate it correctly as a control measure and one way to eliminate the need for validation by Data Verification Operator.

My question: How can I create a rule that multiplies two cells in each row of a line item table, checks the result with another cell, and if necessary force-writes the calculation result into a target cell? Can you provide a solution or script samples if this is achievable only by script?

Thank you.

Order By: Standard | Newest | Votes
Ekaterina posted this 10 August 2017


We demonstrate the solution on the screenshot. Note that the script should not be placed on the Table level.

"number", "ABC" and "Multi " are the columns of the "Block" table.

Mustafa_N097 posted this 10 August 2017

Hi Ekaterina,

Do your post have an attachment of the screenshot that demonstrates the script? I was not able to locate it. I just started to use the forum, so help will be appreciated.


Ekaterina posted this 11 August 2017


Please try to clean your browser’s cache or use another browser.

Mustafa_N097 posted this 23 August 2017

Hi Ekaterina, 

An exact script (C#.Net) placed at Rule Global Script Module, do not seem to work. Field names are changed to "QtyShipped", "UnitPrice" and "ExtendedAmount". IField command and the following code lines are deemed to have errors. See the attached files.

Do I need to address the LineItemsTable block and the columns being multiplied within the script? Do I need to tell Extended Amount field in DocDef to use this script, by choosing this script rule at field level?

Thanks in advance.


Attached Files

Ekaterina posted this 31 August 2017


Our original script did not contain any colons after IFilds. Please make sure that you are using correct syntax.