Datasets
A dataset is a saved query. Charts are always drawn from a dataset. A dataset holds:
- which columns and rows are used (the query),
- how columns are named on screen (display names),
- the aggregates ready for charts (measures),
- how long results are kept in the cache.
Only you see your datasets.
Reports → Datasets. List columns:
| Column | Content |
|---|---|
| Name | The dataset’s name. |
| Connection | The connection the query runs on. |
| Columns / measures | E.g. “12 columns · 3 measures”. |
| Cache | E.g. “300 s” or Off. |
| Updated | The time of the last change. |
You can narrow the list to one connection with the Connection filter (All connections shows them all).
If you have no datasets yet, the page says No datasets yet.
Creating a dataset
Section titled “Creating a dataset”There are two ways:
- Create from SQL: Opens the SQL editor. You write the query and click Save as dataset. See SQL editor.
- Generate from a form: Turns a form’s submissions into a dataset without SQL. See Generating a dataset from a form.
Editing a dataset
Section titled “Editing a dataset”Click a dataset in the list. The header shows its name, Connection: … and the revision number (“Revision 3”). The page has four sections.
General
Section titled “General”| Field | Rule |
|---|---|
| Name | Required, at most 100 characters. You cannot have two datasets with the same name. |
| Description | At most 1000 characters. |
| Cache time (seconds) | A whole number from 0 to 86,400. 0 turns the cache off. |
The cache time is how long a chart’s result is kept. If the same chart is opened again within that time, the database is not queried; dashboards open quickly. Choose it by how fresh the data must be: 3600 (one hour) for daily reports, 60 for live monitoring.
The text of the query. When you change the SQL:
- the warning “The SQL changed: the preview runs the new text, and saving changes the dataset.” appears,
- Preview runs the new text without saving,
- on save the columns are read again and the revision number goes up by one.
If a column a measure uses is not in the new query, saving stops: “The query’s columns changed and a saved measure loses its column. Fix the measures and save first.” If you remove a column that charts use, those charts break (Chart builder).
Sync columns reads the stored query’s columns again after new columns were added to the report views (“Columns synced.”).
Columns
Section titled “Columns”The table columns are Column (the name in the query), Type, Display name and Time (ticked for date columns).
The Display name is shown on charts and dashboards instead of the column name. For example, write “Submitted on” for
submitted_at and “Score (%)” for score_percent. If you leave it empty, the column name is shown.
Date columns can be grouped by day, week, month, quarter or year in charts.
Measures
Section titled “Measures”A measure is a ready aggregate over a column. When you build a chart you pick the measure by name, so “Inspection count” or “Average score” is calculated the same way in every chart.
- Click Add measure.
- Fill in the row:
| Field | What to enter |
|---|---|
| Measure name | A short, unique name, e.g. denetim_sayisi. |
| Display label | The name shown on screen, e.g. “Inspection count”. |
| Aggregate | Count, Count distinct, Sum, Average, Minimum, Maximum. |
| Column | The column to aggregate. Only Count can go without a column: All rows. |
- Save.
What the aggregates mean:
| Aggregate | Result | Column |
|---|---|---|
| Count | The number of rows (with a column: the rows where that column is not empty). | Optional |
| Count distinct | The number of different values in the column, e.g. how many different locations. | Required |
| Sum | The total of the values. | Numeric |
| Average | The average of the values. | Numeric |
| Minimum / Maximum | The smallest or largest value. | Sortable (number, date, text); numbers only in charts other than tables |
Rules and messages:
- “Every measure needs a name, and the names must differ.”
- “Measures other than “Count” need a column.”
- “The measure’s aggregate does not fit the column’s type: …” (for example, the average of a text column).
- A dataset holds at most 50 measures.
Remove a measure with the remove button at the end of its row.
Saving
Section titled “Saving”When you make a change, “There are unsaved changes.” appears. Click Save; the message “Dataset saved.” appears.
If someone else changed the same dataset while you were looking, the message “This changed while you were looking at it. Reload the page and try again.” appears.
Creating a chart
Section titled “Creating a chart”Create chart on the dataset page opens the chart builder with this dataset chosen. See Chart builder.
Deleting
Section titled “Deleting”- Click Delete. The Delete dataset dialog says “The dataset “…” will be deleted. It cannot be deleted while charts use it.”
- Confirm. The message “Dataset deleted.” appears.
If charts use it, the message “4 charts use this dataset. Delete them first.” appears.
Example
Section titled “Example”The “Inspections and locations” dataset (the query from the SQL editor example):
| Column | Display name |
|---|---|
lokasyon |
Location |
submitted_at |
Submitted on |
score_percent |
Score (%) |
passed |
Passed |
| Measure name | Display label | Aggregate | Column |
|---|---|---|---|
denetim_sayisi |
Inspection count | Count | All rows |
ortalama_puan |
Average score | Average | score_percent |
lokasyon_sayisi |
Locations inspected | Count distinct | lokasyon |
Cache time: 3600.