Generating a dataset from a form
You do not need to write SQL to report on a form’s submissions. Defthand writes the query that opens every field of the form’s current version into typed columns and saves it as a dataset. You can edit the dataset as you like afterwards.
What you need
Section titled “What you need”- A connection in Ready status with access to forms (Connections).
- A form with at least one published version (Forms).
- On the Reports → Datasets page, click Generate from a form. The Generate a dataset from a form dialog opens.
- Choose a Connection.
- Choose a Form. The list shows the forms the connection can read that have a published version. If there are none, it says “This connection reads no published form.”
- Optionally enter a Name. If you leave it empty, the form’s title is used.
- Click Generate. The message “Dataset generated from the form.” appears.
If you already have a dataset with that name, “ (2)“, “ (3)” is added to the end of the name. The dataset’s description records which form it was generated from.
The generated dataset
Section titled “The generated dataset”- Each form submission is a row.
- The first columns are about the submission itself:
submission_id,form_version_id,submitted_at(submission time),submitted_by_user_idandsubmitted_by_employee_id(the submitter’s identifiers),status,channel,locale,duration_seconds(time spent filling in). - Then comes a column for each field of the form. The column’s name comes from the field’s key, its display name from the field’s label. Fields inside a group are opened; their display names read “Group / Field”.
- Fields are read in their own type: number fields as numbers, yes/no fields as yes/no, date and date-time fields as dates, time fields as times, single choices as text (as numbers if their values are numbers). So totals and date grouping work at once. A value that cannot be read comes through empty; it causes no error.
- Submissions of every version of the form are included. The columns follow the form’s current version; old answers of a field whose key changed later appear empty.
- A ready measure that counts submissions is added:
submissions(Count, all rows). You can give it a display label. - The cache time defaults to 300 seconds.
Fields kept as JSON
Section titled “Fields kept as JSON”Fields that carry several values do not fit in a single value. They are kept in one JSON column:
- repeat fields,
- grid fields,
- matrix fields,
- multiple choices, file and location fields.
At the end of generation, repeat, grid and matrix fields are listed under the heading Fields kept as one JSON column, for example “ekipmanlar (repeat field): kept as one JSON column.” If their inner fields were not opened, those are listed too.
To report on these fields you need to write the dataset’s SQL yourself.
If the form changes
Section titled “If the form changes”When you add a field to the form and publish a new version, the existing dataset does not change on its own. To see the new field, generate the dataset from the form again (the new dataset is created separately; you need to move your charts to it) or edit its SQL.
Example
Section titled “Example”The “Vehicle Check Form” has these fields: Plate (text), Mileage (number), Tyres OK (yes/no), Check date (date), Notes (long text). The generated “Vehicle Check Form” dataset contains:
- the submission columns (
submitted_at,status…), - the field columns: Plate text, Mileage number, Tyres OK yes/no, Check date date, Notes text,
- the
submissionsmeasure.
With this dataset you can draw a “Checks by month” line chart or a “Vehicles with tyre problems” table right away. From start to finish: Example: monthly vehicle check dashboard.