Command
XML element with command definition
xpath = srs/def/itm[@model='command']
"Hello World"
Command Attributes
Required
name- name of dataset; defaultd1,d2,d3... (d+ position). Must not contain/.- name=
srssetup=> business logic command that is always executed first
- name=
body of command- SQL text, or a stored procedure name
- a single name without spaces (e.g.
[dbo].[task_set]) is called as a stored procedure; request parameters are matched to the procedure parameters by name,nullvalues are not sent so procedure defaults apply. See stored procedure as endpoint
srssetup
- srs with name =
srssetuprun always as first - if throw error nothing will be executed
Any property from srs can be used to modify srs behavior, required double brackets [[propertyname]] especially:
- description
- column label
- column value
- column opts (you can use opts an lg-true, lg-false , sm-true, sm-false) to override visibility of column
- column css
- parameter value
- option value
- command type
- command opts
- command css
Optional
link- connection name; by default uses the default app connectionlink="self"virtual query that lets you query different commands like tables (SQLite syntax); waits for all previous commandslink="srs"lists SRS definitions of the application
label- display labeltitle- title on hovercss- class attributeacl- role requiredactive- command is active; default istruelg- (true/false) show/hide on desktopsm- (true/false) show/hide on mobileex- (true/false) show/hide dataset on export (.html,.xlsx,.md,.txt,.xml)opts- options separated by spaces, e.g.option1 option2 option3- lg-true, lg-false - override desktop visibility; can be set through Business logic in srssetup
- sm-true, sm-false - override mobile visibility; can be set through Business logic in srssetup
- active-true, active-false - enable or disable the command; can be set through Business logic in srssetup
- UI only
uiclipboard- Adds checkboxes for each row in the UI. The first column should have a unique value for single-row selection.uiheader- Displays the result in a header.uifooter- UI footeruinav- UI navigation (TODO: check if obsolete)uimenu- Renders in the command tab of the UI.uiauto-sum- sum all decimal valuesuihighlight-min- highlight column with lowest values a column is only eligible for the if every row has a value >0uivisible- Makes the UI tab visible even without data. By default, commands without data are hidden.uiopen- when the command is in an accordion, forces the initial state to openuiclose- when the command is in an accordion, forces the initial state to closed
- Data transformations
dtacl- Filters rows based on theaclcolumn. Only rows with anaclvalue matching the user's role are returned. If noaclcolumn is present, all rows are returned.dtsplit- Converts a single command into multiple commands based on thenamecolumn (or the first column) Thenamecolumn specifies the command's name. Optionalcsscolumn for style. Use in urlautofor automatic redirect to the first item in UI viasrs/[ID]/auto.dtpivot-cols- Creates a pivot table from the command's result. The first column becomes the row header; remaining columns become rows. See the example below.dtsingle- Data transformation that:- affects
.json,.hbs,.frxrenderers — first row is returned as a single object - affects
.htmlrenderer — the table is transposed (one row per column) - other renderers are not affected
- must be set in
opts, not intype
- affects
- Other
server- server-side only; used to compute properties, not returned in the responsejob- Initiates a "fire and forget" non-query execution performed as a background job. The command timeout is at least 300 seconds.post- Executes when the request is a POST; runs in aread committedtransaction.get- Executes when the request is a GET.pscope- Executes when the command name is inpscope.
- Query effects (optional)
jq-nonquery- non-query executionjq-committed-read committedjq-uncommitted-read uncommittedjq-snapshot-snapshotjq-none- none
type(default table viewv_srs_table)v_srs_tiles- UI tiles viewv_srs_description- show description node ex<itm model="command" name="view" label="Opis" type="v_srs_description">select getdate()</itm>v_srs_map- UI map viewv_srs_form- UI form viewv_srs_header- UI header viewv_srs_heading- UI header viewv_srs_iframe- embed a standalone html pagev_....- any component
UI Example
When you want render command using custom UI component you need to use type attribute with value v_... .
v_... is a name of component that will be used to render command.
| XML | |
|---|---|
Data Transformation examples
dtpivot-cols
INPUT:
| YEAR | ESTIMATED | BUDGET | SPENT |
|---|---|---|---|
| 2024 | 900 | 1000 | 1200 |
| 2025 | 1100 | 1000 | 1300 |
| 2026 | 1200 | 1200 | 1400 |
| 2027 | 1400 | 1300 | 1500 |
OUTPUT:
| YEAR | 2024 | 2025 | 2026 | 2027 |
|---|---|---|---|---|
| estimated | 900 | 1100 | 1200 | 1400 |
| budget | 1000 | 1000 | 1200 | 1300 |
| spent | 1200 | 1300 | 1400 | 1500 |
Transactions and Isolation levels - SQL Server
By default:
- the isolation level is
read uncommitted - a SQL text command runs without a transaction;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTEDis added in front of the command in the same batch - a stored procedure or a
jq-nonquerycommand runs in aread uncommittedtransaction - if command opts contain
post, the isolation level isread committedand the command runs in a transaction that is committed when the command ends successfully, otherwise rolled back
You can override the default behavior by adding a keyword to the command opts:
read committedin a transaction by addingjq-committedread uncommittedby addingjq-uncommittedsnapshot* in a transaction by addingjq-snapshotunspecifiedby addingjq-none- no transaction and no isolation level is set
Example jq-none scenario:
Imagine complex procedure, when you want manage transaction manually inside the procedure and you don't want outer transaction context.
for example write to custom log table or commit part of code that can be achieved by adding jq-none to the command opts.
When isolation level is defined in command
| SQL | |
|---|---|
Note
Snapshot isolation requires ALLOW_SNAPSHOT_ISOLATION and READ_COMMITTED_SNAPSHOT to be set to ON in the database.
linked servers
If the command returns "Unable to enlist in the transaction", set the transaction to jq-none or review the linked server properties.
| Isolation Level | Dirty Reads | Phantom Reads | Unrepeatable Reads | Readers Block Writers | Writers Block Readers | Readers And Writers Deadlock |
|---|---|---|---|---|---|---|
| Read Uncommitted/NOLOCK | Yes | Yes | Yes | No | No | No |
| Read Committed | No | Yes | Yes | Yes | Yes | Yes |
| Read Committed Snapshot Isolation | No | No | Yes | No | No | No |