Query Builder

Learn how to configure reference data matching for template columns — from simple field lookups to complex nested queries.

Overview

Reference data mapping lets a column look up a value from an external dataset at extraction time. Instead of relying purely on AI inference, the column searches your dataset for a record that matches the extracted content, then returns a specific field from that record.

Two pieces of configuration control every lookup:

  • Match fields — the dataset fields used to find the right record.
  • Return field — the field whose value is returned once a record is found.
Configure prompts

Once a dataset is selected, the Configure prompts accordion lists every dataset field (excluding the return field). Click the edit icon next to any field to open a textarea for that field's prompt instruction.

  • Prompt instruction — optional guidance for the AI on how to extract or interpret that field's value from the document.

Prompt instructions are optional. Leave them blank to rely on the field name alone for extraction guidance.

Changing the selected dataset clears all configured prompts, the return field, and the saved query. The same happens if the dataset is deleted.

Query builder

The Configure query section is always available once a dataset is selected. Click Configure to open the query builder dialog and define which fields are matched and under what logical conditions.

Node types

  • Field — a single dataset column. Select it from the dropdown.
  • Group — a set of nodes (fields or nested groups) joined by AND or OR. Click the operator badge to toggle it.

Building a query

  • Add field — adds a field node to the current group.
  • Add group — nests a new AND/OR group inside the current group. Depth is shown with a coloured left border.
  • × button — removes a node from its parent. The root group cannot be removed.

Example

Match records where Name matches AND either Email or Phone matches:

ANDroot
├─fieldName
└─ORgroup
├─fieldEmail
└─fieldPhone
Testing with the preview panel

The Preview panel appears below the configuration whenever a valid query exists. It lets you test the match logic before saving.

  1. Enter a test value for each field shown in the panel.
  2. Click Match.
  3. The output shows the result:
  • A green tick and the matched value if a record was found.
  • No match found if the query returned no result.

The preview reflects the active mode — simple or advanced. In simple mode, all configured match fields appear as inputs under an implicit OR root.

The return field

The return field is the dataset column whose value is written to the column when a match is found. It is separate from the match fields and is always excluded from them to avoid circular lookups.

The Match button in the preview panel is disabled until a return field is selected.

Example: a dataset has columns Customer Name, Email, and Discount Code. You match on Customer Name and Email, and return Discount Code. The column in the template will then contain the discount code for the matched customer.