Lookup control¶
Suggest is a text field with a search behind it. The user types, the form queries the source and offers the matching values; the chosen value is what the control stores.
It is the control for long catalogues — customers, products, cities — where a dropdown would be unusable and free text would be wrong.
What the control needs¶
| Setting | Purpose |
|---|---|
| Database connection | Where the values live |
| SQL | The query that returns the values and their labels |
| Search field | Which column the typed text is matched against |
| Filter | A fixed condition applied to the query before the search |
| Limit | How many results are offered at once |
The search runs in two ways, and both matter:
- By term — the typed text is matched inside the value or the label.
- By match — an exact value wins over the rest, so a code typed in full appears first even when other rows contain the same characters.
Typing a value that does not exist¶
The control can also add a value. When the typed text is not in the source, pressing Enter inserts a new registry, and the form says so: New value inserted in the table. The hint in the properties panel states the same rule before anyone tests it.
That behaviour is convenient for a catalogue that grows while people work, and dangerous when the catalogue is supposed to be closed. If the list must not grow, use a dropdown and control who edits the source.
In a case¶
- The value is stored like any other field; the search is only how it was chosen.
- Only the chosen value is kept, not the list of suggestions.
- If the source changes later, the case keeps the value it stored.
In a condition¶
Read it with @@ and compare against the stored value, not the label:
@@CustomerCode == "C-1042"
Related¶
- Choice controls — when a fixed list is enough.
- Database connections — the connection the query uses.
- Control properties — the shared panel.