Basics¶
Variable¶
Variable is the cornerstone of xDash. With the Variable dataNode type, a JSON, an array or a primitive variable can be manually defined or read from file.
A variable is readable and writable : its value can be modified by a widget. This makes xDash different from other tools that only perform visualization of dataNodes.
Simple example : simple-json.xprjson
Click EDIT JSON... link to open the JSON editor, and manually edit the variable, read it from a file or save it to a file.
Formula¶
Formula is used to write specific JavaScript code, and use other xDash workspace variables (referenced using keyword dataNodes
).
DataNode formula
uses the dataNode variable
, specifically its property named value
. It is achieved by specifying the keywords dataNodes["variable"]["value"]
.
The code is executed according to xDash runtime rules.
A final return
statement is required to return the result of the formula evaluation to xDash workspace.
Simple example :
Sequencing¶
- xDash keeps track of a global dependency graph (a Direct Acyclic Graph). This graph specifies both data and execution dependencies.
- When a dataNode output changes, all dependent dataNodes are automatically re-executed.
This dependency graph above describes the relationships of the dataNode formula
above.
REST web-services¶
The dataNode type REST Web-service is used to call functions exposed as REST web-services. Input arguments may come from xDash workspaces (referenced using keyword dataNodes
). The response is then evaluated in the workspace, if the call was successful.
Typically, the information required to write the dataNode comes from the web-service API documentation. It may use Swagger.
Parameters¶
URL¶
The URL of the HTTP request.
The following examples illustrate xDash syntax for path and how to use code to modify query arguments passed in URL.
xProxy¶
xProxy concept was inspired by ThingProxy.
It allows to overcome web-browser CORS (Cross-Origin Resources issues) restrictions. As xDash runs on a web-browser, it is subject to browser's CORS policy.
Please disable xProxy if you call a localhost or private network webservice.
Some examples¶
Simple GET¶
webservice-get.xprjson : this is a simple GET example with no input arguments.
Simple POST¶
webservice-post-simple.xprjson: this is a simple POST example with body as a JSON.
GET with arguments¶
webservice-get-args.xprjson: this example illustrates a GET call where arguments (custom path and query arguments) are defined using the urlAppend object in the body field.
GET with arguments from another dataNode¶
webservice-get-input.xprjson: in this example, two variables defined in a variable dataNode are used as inputs to the GET web-service call.
POST with arguments from another dataNode¶
webservice-post-input.xprjson: in this example, two variables defined in a variable dataNode are used as inputs to the POST web-service call.
Triggered POST¶
webservice-post-input-triggered.xprjson: if the explicit trigger option is checked, the dataNode is only executed when an explicit click is performed (using a connected push button widget or the update button). When predecessors change, the dataNode execution is no longer triggered. This feature is useful for building form-like interfaces. See also Execution flow control parameters