Write and validate a View query

A View is defined by one query: the SELECT statement that shapes the rows the view exposes. Write it on the Query step of the View popup, validate it, then save. The step follows General in the wizard; the whole view flow is on Views.

Write the query

  1. Open the view and go to View > Query. When you create a view, save General first: the query belongs to the view, and History appears only for a saved view.
  2. Write the SELECT that returns the columns the view should expose. The columns it returns appear on the View columns step, where you set their types, keys and permissions.
  3. Where a value should change between runs, write a placeholder such as {region:String} instead of a fixed value. Each placeholder becomes a parameter of the view; see Work with parameters below.
  4. To draft or change the query with AI, click AI in the editor header (tooltip "Generate with AI"). The flow is on Generate and fix SQL with AI.

Validate the query

Work with parameters

A parameter is a placeholder written in the query as {name:Type}. The parameters panel below the editor depends on the view type:

View typeParameters panel
StandardHidden.
RefreshingHidden.
ParametrizedOne row per parameter, with a Name, a Type and a Value.
AppendingThe required parameter {sync_n_days:Int32} only.
Note

Standard and Refreshing views take no parameters, so their query step shows no parameters panel.

Copy the query

Copy in the editor header opens two actions:

Restore an earlier revision

  1. Click History in the editor header (tooltip "Query history"). It appears once the view has been saved.
  2. Pick a revision in the window. Picking one replaces the query in the editor and marks it Not validated, so validate and save it again.

Save the query

Questions, answered

Why is Validate disabled?

The check starts only when the editor has a query, every required parameter has a value, and no other check is running. Fill in what is missing, then try again.

Can I stop a check that is running?

Yes. Click Stop while the button shows it; DataMind confirms with "View validation cancellation requested", and the running query stops.

Can I see the rows a view query returns?

Yes. A successful check opens a result window with the rows it returns, so you can inspect the result before you save. Nothing is saved by the check itself.

Do I have to validate again after I edit the query?

Yes. Any change marks the query Not validated and blocks the save and Next until you check it again. Applying an AI suggestion or restoring a revision counts as a change too.

Why can't I save my query?

The step saves only a filled, validated query: an empty one is refused with "* Query must be filled to proceed", and an unchecked one with "Query not validated". Click Validate, wait for Validated, then click Apply.

Which parameters does an Appending view need?

One: {sync_n_days:Int32}, filled from Incremental Days on General. The query must use it, you cannot add more, and saving without it is refused.

Why don't I see History?

History appears for a saved view only. When you create a view, save General first; after that, the saved revisions of the query are listed in the window.

Why must the query keep the view's primary key columns?

When you save a changed query, the view checks that the column it uses as its primary key still comes back from the query. If it does not, the update is refused with "View query update must include all existing primary key column(s)". Keep that column in the SELECT and save again.