Skip to main content
Every audit already keeps copies of what it reads. A query asks your own question of those copies: which orders sat backordered for three days, which findings are older than a week, what a saved run’s newest differences add up to. You ask in plain words, the agent writes the query and runs it before you see it, and a schedule can email the answer every morning. A query only reads. It never writes to Darpan or to your systems, and it reads only what your audits keep, never a system live.

Before you start

Confirm:
  • You are a Tenant admin or Company editor in the active tenant to write, run and save queries. Anyone with view access sees the list and each query.
  • You are a Tenant admin to schedule a query. A schedule sends the tenant’s data out, so only a Tenant admin can set it up, switch it on or send it.
  • For the Ask box: the agent is on for your tenant and a Darpan admin has given you AI access, as for the audit agent. Without both the box does not appear. See AI access.
  • What you want to read is kept. A query reads a dataset’s kept fields, a saved run’s newest result, or an audit’s findings. A field no audit keeps cannot be read.

Write a query

1

Open queries

Choose Queries on the Dashboard, or type Queries in Cmd+K. Choose New Query.
2

Ask for it

Type your question in Ask and choose Ask. The agent reads what your queries may read, writes the read and the script, and runs them on your data. Its run appears under Runs as Agent’s run, and its reply sits under the box.When the agent needs to know which dataset, run or audit you mean, it asks one question, often with answers to choose. When the data is not kept by any audit, it says so and proposes nothing.Ask again to change it: the agent builds on the read and script on the page, your edits included. Put back my version restores what its last proposal replaced. Nothing is saved yet.
3

Check the data, the script and the result

The page reads top to bottom: 1 Data, 2 Script, 3 Result.Data says what the query reads, one sentence per input, for example “Open findings of” an audit, “The latest result of” a saved run, or “Records of” a dataset, with its window, conditions and fields. Select any part of the sentence to change that input in the Data popup, or choose the plus icon (Add data) to add one:Choose Save to put it in the read. The code icon beside Data (Read as JSON) shows the read as JSON; an input with or-conditions, groups, measures or an order opens only there. The trash icon on an input removes it.Script holds the JEXL. The functions a script can call are listed under fn: functions, which opens Query functions.Choose the run button in Result (or press Cmd/Ctrl+Enter) to run the draft. Each run shows its summary, each file with its row count and its first 20 rows, any log lines, and how much work it took.
4

Name and save it

Select the title to rename New query. Names are unique in a tenant. Choose Save query.

Schedule it

1

Set up the schedule

Choose Schedule or Sends to on the fact strip. Answer Set up the schedule.:A schedule must send somewhere: an email address or a chat space. Choose Save.
2

Save the query

The popup and the On schedule switch beside the title change only this page. Choose Save query to keep the query and its schedule together. Until then the title shows • edited.
3

Preview what it would send

Choose Preview send (the eye icon in Result). It runs the saved query now and says what it would send and where, without sending. Any Tenant admin can preview. Only the schedule’s owner sees Send now, which sends it once and records the run.
Whoever saves the schedule owns it, and it sends as them: the page says Sends as name, and lists where it sends in full for everyone who can see the query. At every run Darpan checks the owner is still a member and a Tenant admin of the tenant. If not, the schedule switches itself off and sends nothing. Once a query has a schedule, only a Tenant admin can change or delete it, and saving it makes that admin the schedule’s owner. A config restore or import that creates or changes a query switches its schedules off, for a Tenant admin to switch on again. A run that returns nothing sends nothing. Every file a schedule emails is logged with the addresses it went to.

Find and pin queries

The Queries page is laid out like the Dashboard. Pinned Queries come first: drag a query’s tile there to pin it, or out to unpin it. Pins are your own and kept per tenant, so pins in one tenant leave the others alone. The other queries follow as tiles grouped by what they read: Audit findings, Run results, Kept records, and Script only for a query that reads nothing. Each heading carries its count, and a long group shows six tiles and more. Open a query to see its schedule, where it sends and how its last scheduled run went, on the fact strip. Runs from the query’s page never count as its last run. Links to the old Tenant Settings queries pages still open the same query.

Delete a query

Choose the trash icon beside Save query. The popup asks Delete name?; choose the trash icon in it to confirm. Its schedule stops with it.

Queries from before 3.4.0

Tenant scripts became queries in 3.4.0. Each script arrives as a query with the same name and code. Each schedule it had arrives switched off, posting to the same chat space, until a Tenant admin opens it and switches it on. A script that read a run result arrives switched off with a note in its description: its rows now arrive flat in input.differences, so check the read and the script, then run it before switching it on.

Expected result

Your questions are on the Queries page, the ones you use most pinned at the top. A scheduled one shows Daily at its time and where it sends, and its email arrives with the summary and its files.

Next step

For statuses, limits and the read format, see Queries in the reference. If a run fails or a schedule stops, see Queries in troubleshooting.