Command
XML element that defines a command.
xpath: srs/def/itm[@model='command']
"Hello World"
Attributes
Required
name- name of the dataset; defaultd1,d2,d3... (d+ position); must not contain/srssetup- business logic command that is always executed first, see srssetup
- element value (text or CDATA) - 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
- a single name without spaces (e.g.
Optional
link- connection name; by default the default application connection is usedlink="self"- virtual query that lets you query the results of other commands like tables (SQLite syntax); waits for all previous commandslink="srs"- lists the SRS definitions of the application
label- display labeltitle- title on hovercss- CSS classacl- permission requiredactive- whether the command is active; default istruelg- (true/false) show/hide on desktopsm- (true/false) show/hide on mobileex- (true/false) show/hide the dataset on export (.html,.xlsx,.md,.txt,.xml)opts- options separated by spaces, e.g.option1 option2 option3lg-true,lg-false- override desktop visibility; can be set through business logic insrssetupsm-true,sm-false- override mobile visibility; can be set through business logic insrssetupactive-true,active-false- enable or disable the command; can be set through business logic insrssetup- UI only
uiclipboard- adds checkboxes for each row in the UI; the first column should have a unique value for single-row selection; required by options of typepa_post,pa_post_manyandpa_post_clipboarduiheader- displays the result above the tabs; whentypeis av_component, the component is rendereduifooter- displays the result in a collapsible section below the active tabuimenu- removes the command from the tabs; whentypeis av_component, the component is rendered next to the options menuuiauto-sum- addsuisumto alltdecimalcolumnsuihighlight-min- highlights the lowest value inuisumcolumns; a column is eligible only if every row has a value greater than 0uipaged10- shows the first 5 rows with "show more" / "show less" buttonsuivisible- makes the UI tab visible even without data; by default, commands without data are hiddenuiopen-uifootersection is expanded on loaduiclose-uifootersection is collapsed on load; by default it is expanded when it has data (desktop only)
- 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 returneddtsplit- converts a single command into multiple commands based on thenamecolumn (or the first column), which specifies the command name; an optionalcsscolumn sets the style; useautoin the URL for an automatic redirect to the first item in the UI:srs/[ID]/autodtpivot-cols- creates a pivot table from the command's result; the first column becomes the row header and the remaining columns become rows; see the example belowdtsingle- 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 and 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 secondspost- executes when the request is a POST; runs in aread committedtransactionget- executes when the request is a GETpscope- executes only when the command name is inpscope; in the UI, the tab is loaded when it is opened, and aselectparameter with the same name loads its list from this command
- 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- shows the description node, for example<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 heading viewv_srs_iframe- embeds a standalone HTML pagev_...- any registered Vue component; it receives thetableandapiprops and can emitreload-eventto run the SRS again
srssetup
A command named srssetup always runs first. If it throws an error, nothing else is executed.
Any property of the SRS can be used to modify its behavior with double brackets [[propertyname]], especially:
- description
- column label
- column value
- column opts (use
lg-true,lg-false,sm-trueandsm-falseto override column visibility) - column css
- parameter value
- option value
- command type
- command opts
- command css
UI Example
To render a command with a custom UI component, set the type attribute to v_..., where v_... is the name of the component.
| 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:
- every command runs in a transaction with isolation level
read uncommitted - 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-uncommittedsnapshotin a transaction by addingjq-snapshotunspecifiedby addingjq-none- no transaction and no isolation level is set
Example jq-none scenario:
Imagine a complex procedure where you want to manage the transaction manually and you don't want an outer transaction context, for example to write to a custom log table or to commit part of the code. Add jq-none to the command opts to achieve this.
When the isolation level is defined in the 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 |