Database Single Query — Reference
Return the first matching database record rather than a collection.
Return the first matching database record rather than a collection.
Before you begin
Section titled “Before you begin”- A working database connection and a disposable test table or records. Validate inputs and enforce access before private reads or writes.
Database Single Query
Section titled “Database Single Query”Return the first matching database record rather than a collection.
Settings
Section titled “Settings”| Setting | Meaning |
|---|---|
| Name | The step name used by later server expressions and named action output. For example, a query named products is available to subsequent steps as products. |
| Output | Includes the named result in the action response. The result can be used by later server steps when Output is off. Several rules initialize Output on although their declared default is false; inspect the saved action. |
| Debug | Changes diagnostic behavior where supported. For regular SQL Query/Single Query it returns query details instead of the normal records. It can expose SQL and bound data. The installed Node.js Custom Query path still executes the query when this flag is set; do not treat it as a general dry-run guarantee. |
| Connection | The database connection definition to use. It must be available and correctly configured for the active target. |
| Query Type | Selects ordinary, single-record or paged-query behavior. Changing it changes the result shape and the controls relevant to the query. |
| Query Builder | Choose the source table, output columns, aliases, conditions, joins and ordering for the generated query. The selected names become the response fields. |
Worked example
Section titled “Worked example”Select a product by a validated id and use a deterministic condition/order when several rows could match. Enable Output and inspect the object fields directly. Repeat with an absent id and implement a deliberate not-found response.
Result and safety boundaries
Section titled “Result and safety boundaries”Single Query does not prove that the database contains only one match. Define a unique key or an appropriate condition. No-record output can be null or omitted according to the runtime/driver path, so test your deployed response instead of assuming an empty array.
Use the database workflow
Section titled “Use the database workflow”Use Database Manager to define and inspect the underlying tables. Use Server Connect to control the data returned to the page, and verify the actual response shape before choosing an App Connect binding.
Check your result
Section titled “Check your result”You can configure the intended query/write scope and verify its result shape or database effect.