Multi-Query Engine
Execute hierarchical SQL record trees and embed them anywhere in your platform. One template, one API call, one complete nested result — across any depth of parent-child relationships.
Quick Navigation
What is Multi-Query?
Understand the engine's core concept: template-driven hierarchical SQL execution that eliminates N+1 query problems.
Read introduction →Use Cases
Explore five real-world scenarios including payroll reporting, org charts, audit trails, config snapshots, and expression embedding.
Browse use cases →Getting Started
Author your first template, store it in dbo.Shared_Configurations, and execute it via the REST API in minutes.
Writing Templates
Master the QueryTemplate JSON schema: root queries, child collections, parameters, options, and output format controls.
Learn template authoring →@parent Tokens
Use @parent.ColumnName to pass values from a parent row into a child query, chaining SQL across record levels.
Expression Directive
Embed live hierarchical data inside any BizFirst expression using {{multi-query:sqlserver.CODE}} directives.
In This Guide
This documentation covers all 18 topics in the Multi-Query Engine guide. Click any link to jump directly to that page.
How the Engine Works at a Glance
Write a root SQL query and declare one or more child collections, each referencing parent columns via @parent tokens. Save the JSON to dbo.Shared_Configurations under a unique catalogue code.
Issue a GET request to /api/v1/expressions/multiquery/{templateCode} with a Bearer JWT. Supply any declared parameters as query-string values.
The SqlServerDeriveEngine resolves the root query, then recursively executes each child level, injecting TenantID from the JWT and @parent values from each parent row.
The engine returns either a compact nested JsonArray (JSON mode) or an expandable cascaded HTML table (HTML mode) — controlled by the outputFormat option in the template or as a query parameter override.
Engine at a Glance
| Property | Value |
|---|---|
| Engine identifier | sqlserver (SqlServerDeriveEngine) |
| Template storage | dbo.Shared_Configurations — Code = catalogue code, Value = QueryTemplate JSON |
| Authentication | Bearer JWT, TenantAdmin role required |
| Output formats | JSON (compact JsonArray) / HTML (expandable cascaded table) |
| Max recursion depth | Configurable via maxDepth option (default 5) |
| Caching | Per-template, cacheSeconds option; set 0 to disable |
| Tenant isolation | TenantID injected from JWT — no caller override path |