Skip to main content

Query Builder Interface

Overview: Query Builder

The Docwize query builder is located in the ‘New’ Module, under ‘Custom Fields.’ This lists created views, as well as provides the place for users to create new queries to build new views.

workflow-builder

'Query Builder' button

'Virtual Views' dialog

When users navigate to the 'Query Builder' section, they encounter the 'Virtual Views' dialog.

workflow-builder

'Virtual Views' dialog

FieldDescription
Create New ViewNavigates to the Query Lab canvas.
(Various names)List of names of created views.

The Query Lab

When users click on 'Create New View', they are directed to the Query Lab. Queries are built in the Query Lab's canvas.

Query Lab canvas

The Query Lab canvas

query-builder

Query Builder: An example query

The Query Lab has four main sections.

Left-hand Section

The left-hand panel has the following tabs:

TabDescription
Custom FieldsLists all available Custom Fields to drag onto the canvas.
TablesLists available system tables.
ViewsLists available system views.
Virtual ViewsLists existing virtual views that can be used as a data source.
FunctionsLists available query functions that can be dragged onto the canvas.
CTEsLists Common Table Expressions (CTEs) defined for the current query.

A Search box at the top filters across all tabs. Each item has a drag handle to pull it onto the canvas.

Top Bar

FieldDescription
Section labelOptionally name the current section of the query.
Save SectionSaves the current section label. Enabled once a label is entered.
PanelsToggles which panels are visible: Sources (left panel), Results (bottom panel), Query (right JSON panel).
Ctrl+K / Command PaletteOpens a command palette for quick actions.
Data connectionDisplays the current database connection (e.g. Docwize Database). Click to open the Select Foreign Data Connection dialog and change the data source.

Upper Central Section

This is the query builder canvas. Users can select items from the lefthand section to drag into the canvas. Fields that are dragged and dropped appear as a node.

workflow-builder

Example: Node

FieldDescription
Link nodesEnables users to link nodes as they build a complex query.
Include in select (eye icon)Includes the column in the select.
DescriptionThe column name. Double-clicking the field allows the column to be renamed.

There are certain fields in a node which are standard:

FieldDescription
OwnIDUnique ID in the table/view.
EntityidUsually represents a document ID.
Entitytype“D” for Document.
EntrydateDate the row was inserted.
EntrypersonUser ID of the user who did the insert.
entrybatchidUUID unique to a batch insert.

Bottom Central Section

The bottom panel has two top-level tabs: Configure Query and Results.

TabDescription
Configure QueryShows the configuration sub-tabs: Columns, Conditions, Grouping, and Settings.
ResultsShows query results after clicking Test Query.

When Configure Query is active, the following sub-tabs appear on the left:

Sub-tabDescription
ColumnsColumn descriptions for the output query.
ConditionsDefines filter conditions applied to the query before results are returned. Conditions use AND/OR logic. Click + Add Condition to add a filter rule; click + Add Inner Group to nest a group of conditions within the current group. These conditions act as pre-filters — they restrict the virtual view’s output at the query level, before data is displayed in any dataview or interface that uses this view.
GroupingApplies grouping and aggregations to the query results.
SettingsAdditional query-level settings.

When viewing the 'Results' view, users have access to the following:

FieldDescription
Select AllFetch all rows.
Page SizeBatch size for pagination.
No/no rowsTotal rows in the query.
Query TimeTime taken for query to execute.

Right-hand Section

FieldDescription
Load from sourceLoads the backend representation of a query (in JSON) for confirmation and/or editing.
Set as sourceUses the jsonlogic query as the source instead of the diagram.
Auto-formatAutoformats edits to JSON.
AI assistAssists in fixing query errors.
Test QueryEnables users to run the query to preview results.
Save DatasourcePrompts the pop-up dialog for a user to save the created datasource.

How to Build a Query

StepDescription
1Select the relevant field(s) and drag them onto the Query Lab canvas, where they convert to nodes.
2Make the relevant row(s) visible on the selected nodes.
3Optional: link rows across nodes.
4Click Test Query and check the Results tab at the bottom to confirm what is populated. Adjust if needed.
5Click Set as Source once editing is complete.
6Click Save Datasource and enter a name.