Calculate the product of 2 fields

in 2. FlexiCapture

Tags: flexicaptureflexilayoutscript

Calculate the product (multiply) of two 2 fields to create a total in a third field

This is useful in situations such as calculating the value (or checking the validity) of an invoice line.

Here is the code to add to a field to multiply two fields. Create a script rule referencing all three fields. In the following example the ‘LineTotal’ field must be read/write.

Context.Field(“LineTotal").Value = (double)Context.Field(“Qty").Value * (double)Context.Field(“UnitCost").Value;
Context.ErrorMessage = “Could not calculate total";
Context.CheckSucceeded = true;