Skip to content

Data sources and lists

Instead of typing a choice question’s options by hand in every form, you can manage them in one place: “Araç listesi”, “Şantiyeler”, “Masraf merkezleri”. When the list changes, every form bound to it shows the new options, and the submitted value is checked against the list.

The Administration → Configuration → Data sources page has two tabs:

  • Lists: fixed lists of values that you keep without writing SQL.
  • Sources: the definitions that forms bind to. A source either reads a List or is an SQL query.

Forms always bind to a source; to bind a list to a form, you first create a source that reads the list.

  1. On the Lists tab, click New list.
  2. Enter a Code (e.g. araclar; it cannot change later), a Name (“Araç listesi”) and a Description. Click Create.
  3. In the Rows section, enter rows with Add row:
    • Value: the code that is stored, e.g. 34ABC123. The same value cannot appear twice in a list.
    • Text: the name the person sees, e.g. “34 ABC 123 - Ford Transit”.
    • Parent value: in sub-lists tied to another list, the value of the parent record (e.g. the province’s value for districts).
    • Order: the display order.
    • Active: a row that is turned off does not appear among the options.
  4. Click Save rows.

To take rows from a file, use Import CSV: the file must be UTF-8, hold at most 5,000 rows, and have the header row value, text, parent_value, sort_order, is_active (the first two are required). Importing replaces all rows in the list.

Example CSV:

value,text,sort_order
34ABC123,34 ABC 123 - Ford Transit,1
34DEF456,34 DEF 456 - Fiat Doblo,2
06GHI789,06 GHI 789 - Renault Kangoo,3

A list cannot be deleted while a source reads it; its row says “Read by sources”.

  1. On the Sources tab, click New source.
  2. General section: Code (cannot change later, e.g. arac_listesi), Name (“Araçlar”), Description, Kind (List or SQL).
  3. If the kind is List, pick the list in the List field.
  4. If the kind is SQL, write the query in the Query section (see below).
  5. Columns and access section:
    • Value column, Text column: the option’s value and its displayed name.
    • Sort column, Parent column: optional.
    • Extra columns (comma separated): columns from the selected row that can be written into other fields, e.g. marka, model.
    • Allowed group codes (comma separated): who may see the source’s rows. If empty, anyone who can bind the source to a form can read its rows in the preview.
    • Search: Automatic, over the text column or In the query, with @q (the text the person types, in searchable lists).
    • Cache (seconds, 0–300): how long results are reused.
  6. Click Create.

SQL sources need technical knowledge and are set up together with your company’s database administrator. The query must be a single SELECT; only the views Defthand opens for this purpose can be read. Parameters are written as @name.

In the Parameters section, enter a Name, Type, Kind, Required and Default for each parameter. Kind:

  • Input: comes from an answer in the form or from a fixed value (e.g. the selected province).
  • Search: the search text the person types (q).
  • Context: values the server fills in: the person filling in the form, their employee record, today’s date, the language.

If the query contains something that is not allowed, the reason is shown before you save.

In the Try it section, Try runs the unsaved definition and shows the first 100 rows, the time and the estimated cost. Search and context values come from your own session. A warning appears for queries that look expensive.

  • Forms using it: the published forms bound to the source, and their versions.
  • Revision history: the earlier states of the source.
  • Disable / Enable: a disabled source gives no options.
  • Delete: it is not deleted while a published form uses it. Past submissions are not affected.

While published forms use a source, its parameters and columns cannot be changed (“Parameters and columns cannot change while published forms use it.”). You can change the rows and the conditions of the query.

  1. In the form designer, select a Single choice or Multiple choice question.
  2. In the Data section, pick the source from the Data source list.
  3. Bind the parameters: Where the value comes from → From an answer or A constant.
  4. When the source is down: Refuse the submission or Accept unverified.
  5. If you like, use Fill on selection to write extra columns into other fields.

Details: Choice fields.

Forms with a question bound to a source cannot be shared through a public link. The submitted value is checked again against the source at the moment of submission; a value that has been removed from the list is refused.