The form definition defines the form fields and table that can be found on a typical form. It also defines what fields and table columns will be output to the final form result.
In order for FormSuite for Invoices to identify a FormField from the information it extracted from an image field, the characteristic of that FormField needs to be defined. These characteristics are known as FormFieldDefinitions and are kept in the FormDefinition. You will need the following information to create a FormFieldDefinition and add it to the dictionary:
Name | A descriptive name of a field on a form. For example, if the data to be collected is the due date, then a good field name would be "Due Date". This name will be returned in the FormField in the results. |
Alias | A set of alternative text strings for the field. For the field "Due Date", the alias could be "Due Date", "Pay By", and "Remit Date". In short, an alias is wording used to identify the data you want to extract from the vendor’s invoices. An alias should be the exact wording you expect to see on the invoice. |
Group | A grouping classification associated with the field, as defined FormFieldGroup. |
RuleDefinitions | The set of rules to be applied to the raw data from the image to found fields. These rules provide a weighting which is used to determine which field to select when multiple fields of the same name are found. The rule types are found in RuleType. |
Type | The expected format of the data extracted from the image for this FormField. For example "Invoice Totals", "Tax", and "Sub-Total" format expectations would be a currency format. The available formats are listed in FormFieldDataType. |
IsOutput | Is flag that defines whether this field will be included in the FormResult. |
IsRequired | Specifies whether this is a required field. |
You have two possible methods to create the custom FormFieldDefinition.
After the FormFieldDefinition has been created and populated, it can be added to the FormDefinition.FieldDefinitions.
Example -An example of creating a FormFieldDefiniton |
Copy Code |
---|---|
// Create a field definition FormFieldDefinition fieldDefinition = new FormFieldDefinition(); fieldDefinition.Group = FormFieldGroup.SummaryFormFieldGroup; fieldDefinition.IsOutput = true; fieldDefinition.IsRequired = true; fieldDefinition.Name = "My Field"; fieldDefinition.RuleDefinitions = new List<RuleDefinition>(); fieldDefinition.RuleDefinitions.Add(new RuleDefinition(RuleType.InsideTopRightZoneRule, 10, "")); fieldDefinition.Type = FormFieldDataType.Currency; fieldDefinition.Aliases.Add(new FieldAlias("My Field")); fieldDefinition.Aliases.Add(new FieldAlias("Other Field")); // Add the field definition to the form definition formDefinition.FieldDefinitions.Add(fieldDefinition.Name, fieldDefinition); |
Example - the procedure an application should follow in adding a new Alias |
Copy Code |
---|---|
FormFieldDefinitionDictionary formFieldList = FormDefinition.FieldDefinitions(); FieldAlias newAlias = new FieldAlias("Wording of Alias"); formFieldList["Name of FormField"].Aliases.Add(newAlias); |
A table definition is required for FormSuite for Invoices to identify and extract table information from the image. This definition specifies the FormTableColumnHeaderDefinitions that are to be found in the form table.
Name | A descriptive name of a column on a form. For example, if the data to be collected is the description, then a good field name would be "Description". This name will be returned in the FormTableColumnHeader in the results. |
DataType | The expected format of the data extracted from the image for this column. For example "Invoice Totals", "Tax", and "Sub-Total" format expectations would be a currency format. The available formats are listed in FormFieldDataType. |
Example - creating a table definition |
Copy Code |
---|---|
// Create a table definition FormTableDefinition tableDefinition = new FormTableDefinition(); tableDefinition.Name = "Line Item Table"; // Setup the columns of the table FormTableColumnHeaderDefinition descriptionColumn = new FormTableColumnHeaderDefinition(); descriptionColumn.DataType = FormFieldDataType.GeneralText; descriptionColumn.Name = "Description"; tableDefinition.ColumnHeaderDefinitions.Add(descriptionColumn); FormTableColumnHeaderDefinition amountColumn = new FormTableColumnHeaderDefinition(); descriptionColumn.DataType = FormFieldDataType.Currency; descriptionColumn.Name = "Amount"; tableDefinition.ColumnHeaderDefinitions.Add(amountColumn); // Add the table definition to the form definition formDefinition.TableDefinitions.Add(tableDefinition.Name, tableDefinition); |