How to Use Data Query Objects
In this article, you will learn how to Add a Data Query Object and Call a Data Query Object from within an Expression. Examples for specific data query objects including DB Request, DB Request (SQL) and Run Panel are provided.
Add a Data Query Object to the Worksheet
First, choose an object in the toolbox under the Data Query Lib section. In this example, a Code Category lookup is used.
Next, drag the object from the Data Query Lib toolbox onto your worksheet.
Then, connect the input and output nodes you will be using.
The Data Query object can be used in mapping like any other data lookup object group.
Call a Data Query Object within an Expression
Items that have default output parameters defined can be used without adding them onto the worksheet. They can be called via expressions in the format:
dataquery_name( arg1, arg2, … )
The arguments of this expression will be delivered as input parameters to the Data Query object specified.
To call a Data Query Object within an expression, start by editing a destination expression. You can choose a library item to be called from the autocomplete dropdown:
Alternatively, you can also drag and drop a Data Query item directly into the expression:
Next, set the input parameters:
Examples
Below are some more examples of particular types of Data Query Objects.
DB Request
The DB Request element allows to use a DB procedure within your solution.
After dragging and dropping the DB Request element to your working area, please click "Settings" (the gear icon in the bottom-left corner):
The following dialog window can help you to choose the appropriate DB procedure and decide whether to let IWS do auto-mapping or not.
Click OK.
If you want to change input parameters manually, set them in the "Properties" window at the right.
You can give a Name to your DB Request element. It is used to construct the result status variable names. If the Name is not empty, the name_STATUS_CODE, name_CHANNEL_STATUS_CODE, and
name_STATUS_MESSAGE variables are created, and can be used in other expressions. See the following table for more details:
Variable | Possible Values and their Description |
---|---|
name_STATUS_CODE | 0 (Success) |
name_CHANNEL_STATUS_CODE | If name_STATUS_CODE is not 0, this variable will contain a channel specific status code. |
name_STATUS_MESSAGE | Contains the status message. |
DB Request (SQL)
The DB Request (SQL) element allows to use a SQL statement in the rule to interact with the database. After drag-and-dropping the DB Request element to the work area, please click "Settings":
The dialog window helps to specify additional parameters for the SQL statement:
Then enter the SQL query in the "Expression" cell:
The DB Request (SQL) element can have a Name. It is used to construct the result status variable names. If this attribute is not empty, the name_STATUS_CODE, name_CHANNEL_STATUS_CODE, and
name_STATUS_MESSAGE variables are created, and can be used in other expressions.
Variable | Possible Values and their Description |
---|---|
name_STATUS_CODE | 0 (Success) |
name_CHANNEL_STATUS_CODE | If name_STATUS_CODE is not 0, this variable will contain a channel specific status code. |
name_STATUS_MESSAGE | Contains the status message. |
The "Properties" window to the right allows to specify the parameters of the DB Request (SQL) element manually.
Run Panel
The Run Panel element allows to execute a panel and retrieve the data received from the STAR engine.
After drag-and-dropping Run Panel to the work area, click "Settings" button in the bottom-left corner to select a panel:
The following dialog window will open. You can either scroll to the required panel or use quick search:
Once the panel is chosen, click OK.
IWS will automatically fill in several fields:
You can give the Run Panel element a specific Name. The Name is used to refer to the Run Panel element and to check execution results. If this attribute is not empty, the Name_STATUS, Name_STATUS_MESSAGE, and Name_PANEL_STATUS variables are created and can be used in other expressions.
Variable | Possible Values and their Description |
---|---|
Name_PANEL_STATUS | 0 – The panel was not executed. For example, |
Name_STATUS_MESSAGE | Success. |
Name_STATUS | 1 – Success with data. |
The "Properties" window to the right allows to edit several parameters of the Run Panel element manually:
Data Lookup
The Data Lookup provides the ability to perform lookups.
After dragging and dropping it to the work area, you can select the required lookup:
The following dialog window opens:
You can either browse the file tree to find the needed lookup, or one can use Quick Search. IWS fills in several fields automatically, and you can fill in the input parameters manually, for example:
The Data Lookup element can have name parameters. A name is used to refer to the Data Lookup element, later, to check the execution results.
If this attribute is not empty, the Name_STATUS, Name_STATUS_MESSAGE, Name_RESULT and Name_LOOKUP_STATUS variables are created and can be used in other expressions.
The below table lists the possible values and descriptions for the name parameters.
Variable | Possible values and descriptions |
---|---|
Name_LOOKUP_STATUS | 0 – The panel was not executed. For example, the Data Lookup execution condition did not evaluate to TRUE. 1 – Success with data. 2 – Success with no data. -1 – Error. |
Name_STATUS_MESSAGE | Success. Query returned no data. Error. |
Name_STATUS | 1 – Success with data. 101 – Success with no data. Other values – error. |
Name_RESULT | The results of the lookup. |