Query Builder

Query Builder UI

The Query Builder helps users create structured data queries without hand-editing raw SQL. It is most useful when a query needs to be reused by dashboards, reports, pages, or agent tools.

Why Use Query Builder

Business applications often need repeatable questions:

  • Leads by source and status
  • Orders by region and month
  • Approval tasks older than a threshold
  • Revenue grouped by customer segment
  • Records missing required operational data

Instead of encoding these in a custom component, define the query as metadata and reuse it.

Query Shape

A query definition usually includes:

PartPurpose
Base model or tableMain data source
Selected fieldsColumns returned to the caller
FiltersStatic or parameterized constraints
Sort orderDefault ordering
GroupingDimensions for aggregation
MetricsCount, sum, average, min, max
ParametersRuntime inputs such as date range or owner

The builder should make these choices explicit so the query can be validated and reused safely.

Parameters

Parameterized queries are safer and more reusable than hard-coded filters.

ParameterExample
fromDateStart of reporting period
toDateEnd of reporting period
ownerIdCurrent user or selected owner
statusSelected process state
tenantIdCurrent tenant scope

Dashboards and reports can bind UI filters to these parameters.

Consumers

ConsumerHow it uses queries
Dashboard DesignerChart and KPI data sources
Report DesignerTables, cross-tabs, and summary blocks
Page DesignerSaved views or filter-backed sections
AuraBotRead-only tools for natural language analytics
PluginsReusable data contracts packaged with metadata

When a query becomes part of an agent tool, add a clear description and parameter examples so the model knows when to call it.

Safety

Query Builder should not become a bypass around application permissions.

Recommended rules:

  • Keep tenant scope explicit
  • Prefer model-aware queries where possible
  • Avoid returning sensitive fields unless needed
  • Apply row-level permission rules in the backend
  • Review expensive aggregations before publishing
  • Add limits for exploratory queries

Publishing Checklist

  • Query name describes the business question
  • Parameters have labels, types, and defaults
  • Empty results are expected and handled
  • Dashboard/report consumers have been tested
  • Agent usage description is present if exposed to AuraBot

Next Steps