From Simple Wiki

The Autofill feature of SimpleIndex is an easy way to associate many index fields with one document without retyping data that already exists in another application. Autofill uses a database lookup to retrieve records that match a key value entered by the user. Blank index fields are then filled in automatically with the data from this lookup. The result is a document database with many different possible search fields, of which only one needed to be entered during scanning.

The key field may be typed by the user or it may be read from the document automatically using barcode recognition or OCR. The lookup is performed either when the user changes this field or when the index values are saved. If the lookup finds multiple matching records, the user is notified and the first set of values is used by default.

Autofill Settings[edit | edit source]

SimpleIndex Simple setup Configuration Wizard Autofill Data Source Settings Screen
Autofill Data Source Settings Screen

The Index Autofill feature uses the same configuration options as are available with the Data Source option on the Database panel. You may use the New Data Source button to browse to an Access database, ODBC data source file, data source name or OLEDB connection string in this field.

Use the drop-down arrow to select the current data source from the Database tab. Refer to the Database settings for more information on configuring a Data Source.

You can use either a table or a view as the source for your data. The field used to lookup data should be unique for every record. If multiple matches are found, the user is given the option to select the correct value.

Configuring Autofill[edit | edit source]

To configure the Index Autofill feature, you must follow these steps:

  1. Use the same source as the Database panel or click New Data Source to choose a different database
  2. Select the name of the lookup table or query in the Table or View setting.
  3. Select the primary database field used for lookups in the Database Key Field 1 setting. This field should uniquely identify a record in the lookup table.
  4. Select the corresponding SimpleIndex Index Key Field 1 in that setting. Values for this field are used to lookup records in the database.
  5. If a single field cannot determine a unique matching record, add Key Field 2 and 3 as needed to ensure the combination of values is unique.
  6. Configure fields as type Autofill in the Index Field Wizard and enter the corresponding database field names in the Template setting for each.

Other Autofill Options[edit | edit source]

  • Match on single Key Field changes the default behavior to fill in values if any key field is present instead of all.
  • Allow manual input in Autofill fields: allows the user to manually type in data in Autofill fields if no matching record is found.
  • Automatically select first matching record: if multiple matches cannot be avoided, check this option to automatically populate Autofill fields with data from the first matching record without prompting the user.
  • Cascading List Mode sets each Autofill index as a drop-down. The selections for the drop-downs are filtered by selections in previous Autofill fields.

The Autofill settings are also used in Match and Attach mode to specify the key field(s) used to determine a matching record. In this case the Data Source and Table or View should match the settings on the Database tab.

Following the database field name is a pipe “|” followed by the field type (String, Numeric or Date). This is required for SimpleIndex to properly format the lookup for numeric and date fields. If no pipe is found, the default value of String is used.

Multiple Matches[edit | edit source]

SimpleIndex Simple Setup Configuration Wizard Database Autofill Multiple Match Screen
Autofill Multiple Match Screen

When a unique match is not possible, users can select from a list of matching records to fill in the correct field values.

For example, a Sales Order Number could correspond to one or more Purchase Orders. If there is a single Purchase Order then the value will be filled in automatically. If there are multiple POs the user will be prompted to select one in the dialog shown here.

Cascading List Mode[edit | edit source]

SimpleIndex Simple Setup Configuration Wizard Database Autofill Multiple Match Selection
Cascading Autofill Dialog

Cascading List Mode lets you filter each list field by the values you select. For example, you could have lists for Vendor Name and Invoice Number, and when you select a Vendor from the list, the Invoice Number list will only show invoices from the selected vendor.

The table or view selected in the autofill settings must contain all of the items for every list field that will be used. It may be necessary to create a custom view in your database that joins records from multiple tables.

The Index Key field will be the first field displayed, and can be pre-filled using automation like OCR and barcode recognition. Configure the other fields in the cascading list group as Autofill field types. These will be displayed in the order they appear in the field list.

When processing a batch, the list selection dialog will be displayed when you set the value for the Index Key field. When a value is selected or changed and the cursor leaves the key field (by clicking or hitting Tab), the cascading list selection dialog will be displayed.

Template Autofill[edit | edit source]

OCR Template Autofill
OCR Template Autofill

You can map an Autofill field to the Template setting for an OCR field to use the lookup to get a different template based on the key value.

This is most often used in invoice processing to get a vendor-specific pattern for the invoice number.

To configure an Autofill Template:

  1. Add a column to your Autofill data source
  2. Enter the Template corresponding to each row. You can use the standard format or Regular Expressions.
  3. Create an Autofill field and map it to the Template column.
  4. Create an OCR field and use the %FIELD#% Fixed field template, where # is the field number for the Autofill field created in the last step.

Since the template gets the value using a Fixed field string instead of the Autofill lookup directly, it is also possible to dynamically build templates from multiple fields and Fixed field variables.

Custom Code Autofill[edit | edit source]

If a direct database connection is not available, a Custom Code Autofill can be used to interface directly with other systems via API calls or any other available method.

Sample code in C# .NET Framework 4.8 can be found in the Custom Code Integrations subfolder of the Sample Jobs.

Simply create a class module that contains the following function prototype:

public string[] SampleLookup(string keyValue1, string keyValue2, string keyValue3)

In the Autofill settings, enter the following settings:

  • Datasource is the path to the dll class module. Keywords for Default Folders can be used. For example, %CONFIGFILEFOLDER%\CustomAutofill.dll
  • Table or View references the function in the format Namespace.Classname|FunctionName
  • Key Fields are mapped normally, and will be passed as keyValue1, keyValue2, and keyValue3 to the Autofill function.

The Sample Jobs folder also contains a job file called E - Read Invoices with Custom Autofill and Export.sic that demonstrates the use of the Custom Autofill feature.

The function must return a string array with one item for each Autofill field defined in your Job File. An error will occur if the number of fields does not match the length of the array.

AI Autofill with ChatGPT[edit | edit source]

The ChatGPT document analysis feature uses the custom Autofill to submit AI prompts based on the document contents and index field values, saving the result into a new field.

To use the ChatGPT Autofill feature, set the Datasource setting to Simple.AI.dll and map the Database Key Field 1 to a Fixed field containing the AI prompt you wish to use.

See the ChatGPT page for details.

Configuring Autofill Video[edit | edit source]

Video was recorded in a previous version of SimpleIndex. Refer to the wiki documentation for latest updates.

Related Knowledge Base Articles[edit | edit source]