Command
XML element with command definition
xpath = srs/def/itm[@model='command']
"Hello World"
Command Attributes
Required
name- name of dataset default value 1,2,3,4,5- name=
srssetup=> business logic command that is always executed first
- name=
body of command- sql command/procedure
srssetup
- srs with name =
srssetuprun always as first - if throw error nothing will be executed
Any property fro srs can be used to modify srs behavior 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 use default APP connectionlink="self"is a special kind of provider you can query different commands (from diferent connection) like databases
label- display labeltitle- title on hovercss- class attributeacl- role requiredactive- command is active default =truelg- (true/false) show/hide on desktopsm- (true/false) show/hide on mobileex- (true/false) show/hide dataset on export for example to excelopts- options separated with space e.g.option1 option2 option3- UI only
uiclipboard- Adds additional checkboxes for each row in the UI. Important, first column should has unique value in command for select unique (one) row.uiheader- Displays result in a header.uifooter- UI footeruinav- UI navigation (TODO: check if obsolete)uimenu- Renders in the command tab of the UI.uivisible- Makes the UI tab visible even without data. By default, commands without data are hidden.uiopenwhen command is in accordion you can force initial state of accordionuiclosewhen command is in accordion you can force initial state of accordion
- Data transformations
dtsplit- Thisdata transformationconverts a single command into multiple commands based on thenamecolumn or first, and an optionalaclcolumn. Thenamecolumn specifies the command's name, while theaclcolumn assigns a role to the command. Only the firstaclvalue is used as the default ACL for the new command. Optionalcsscolumn for style andautofor automatic redirect to first in uisrs/[ID]/autodtpivot-cols- Thisdata transformationcreates a pivot table from the command's result. The pivot table will use the first column as the row header and the remaining columns as the rows. See the example below.dtsingle- Thisdata transformation- affects
.json,.hbs,.frxrenderer, first row is returned as a single object. - affects
.htmlrenderer, returnsdtpivot-colstransformation - other renderers are not affected
- affects
- Other
server- server side only used to compute properties, not returnedjob- Initiates a "fire and forget" non-query execution performed as a job.post- Executes when the request is a POST, set isolation level by default tojq-committedget- Executes when the request is a GET.pscope- Executes when command name in pscope
- Query effects (optional)
jq-nonquery- non valuesjq-committed-read committedjq-uncommitted-read uncommitedjq-snapshotsnapshotjq-nonenone
- UI only
type(default table viewv_srs_table)v_srs_tiles- UI tiles viewv_srs_map- UI map viewv_srs_form- UI form viewv_srs_header- UI header viewv_srs_heading- UI header viewv_....- 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:
- when API receives GET,POST request, the transaction isolation level is by default
read uncommitted - if command opts contain
postkeyword then the transaction isolation level isread committedand transaction is used by the system and committed when command ends successfully otherwise rollback
You can override default behavior and force transaction and isolation by adding keyword to the command opts.:
read committedby addingjq-committedread uncommitedby addingjq-uncommittedsnapshot* by addingjq-snapshotunspecifiedby addingjq-none- this will remove transaction context
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 transaction level require 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, you need to set the transaction to jq-none or experiment with 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 |