Keywords
A keyword defines the beginning and the end of a block. The keyword used is dependent on the block’s function. All keywords start with an asterisk “*”. Keywords that declare non-terminal blocks end with a slash “/”.
Arguments to keywords are defined within square brackets. For example, when querying for a transaction number, the argument [number] can be used for the keyword *Query
. On the other hand, when filtering, for example, for a specific currency, the argument [currency_id=]
can be used for the keyword *Filter
.
In data processing, the localized names of fields displayed in the UI applications can be used instead of their comKIT counterparts. For example, when querying for a transaction number, transaction number can either be used as the WSS field name “Transaction Number” or the comKIT name “number”.
Common Keywords
Some keywords are specific to a system, while others are common for all systems and sources. The common keywords that work for most/all sources are found below.
Keyword | Description | Arguments? | Start Function? | Target Objects? |
---|---|---|---|---|
*Filter | Filter the given object list by the given condition | ✅ | ✅ | |
*GetValues | Get the values from the target objects and output in the Excel file | ✅ | ✅ | |
*Try | Catch exceptions from other keywords | ✅ | ||
*Assert | Test values produced by *GetValues and *Try | ✅ | ✅ | |
*WhileIf | Do a loop that checks certain fields on target objects. This keyword needs to be inside a *Query block | ✅ | ✅ | |
*Then | Contain the functions that will be executed if *WhileIf got result TRUE | ✅ | ||
*Else | Contain the functions that will be executed if *WhileIf got result FALS. | ✅ | ||
*Stop | Stop an import row, an import header, a worksheet or a task. | ✅ | ||
*Pause | Pause a task for a certain period | |||
*End | The terminator of a block. This keyword can be followed by any text. In order to make the header easy to read, the suggested way is to write the start keyword behind it, such as *EndQuery. | |||
*Service | Declare the type of ComKIT service to connect to | ✅ | ✅ | |
*Options | Declare the options used by factory. This keyword must be inside *Service block | ✅ | ✅ |
Filter
The keyword *Filter provides a filter function on the list of current target objects. This enables users to select specific objects which they would like to process. In other words, the functions inside a filter will be executed on the objects that is returned by the filter.
The filter conditions that the desired objects need to fulfill are entered as arguments to the keyword. These arguments, similar to others, are entered within square brackets with the format [<field name> <operator> (<index>)]
, which contains the name of the field to be filtered, an operator, and, as an option, an index with an integer value. An example is [currency_id=]
. Available operators are listed below.
Value | Expression | Comment |
---|---|---|
= | Equal to | |
<> | Not equal to | |
> | Larger than | |
>= | Larger than or equal to | |
< | Less than | |
<= | Less than or equal to | |
% | Regular expression | Use these two operators for strings only. Samples: ^AB Matches any strings starting with AB. AB$ Matches any strings ending with AB. AB matches any strings containing AB. ^[A-Z][0-9]{1,4}B$ Matches any string starting with a capital character between ‘A’ and ‘Z’, followed by minimum 1 but at most 4 digits between 0 and 9 and ending with a ‘B’ |
!% | Not regular expression | Same as above |
The index part in the condition is optional. It is used when you want to have several conditions with the relation OR. It can also be used to group conditions as several conditions with the same index is in the same group. Conditions within a group are treated as AND, while conditions between groups are treated as OR.
In addition to filtering on specific values, it is also possible to filter on aggregate expressions and other fields on the same business object. Expressions are wrapped in soft parenthesis ‘{ … }’ in the data row. Supported aggregate functions are min and max:
*Filter | [payment_date=] | ... | Comment |
---|---|---|---|
{min(payment_date)} | Finds all objects where the payment_date field is equal to the minimum payment_date value. | ||
{max(value_date)} | Aggregate function ’max’ is also supported. You can also aggregate on other fields than the one used in the filter. | ||
{value_date} | You can reference fields directly, without aggregate function. This will find all objects where payment_date = value_date. |
Expressions can be combined with additional text input:
*Filter | [param_5=] | ... | Comment |
---|---|---|---|
Batch_{param_7} | Expressions can be combined with text input to compose a value. |
GetValues
The keyword *GetValues
is used to fetch data. The arguments for this keyword are the fields of the target objects for which values you would like to get. The results are displayed under each argument in the header row. If several target objects are sent to this function, the output will contain the field values of all the target objects separated by a semi-colon (;).
The example below queries for transaction 1606, executes a roll over that generates a new transaction, and fetches the transaction number of the new transaction in columns J to L. Column K is the argument to the keyword *GetValues, and the output 2012 is placed in the cell under.
The output from *GetValues
is available to functions after it in the same header row. In order to reference to a value from a *GetValues
block, use the format in the data row $<field name>[<index>]
, where the field name should be the same as the field name used by *GetValues
and the index indicates which output value should be used in the return list. Below shows an example of how cell N6 references to the output in cell K6.
Try
The keyword *Try
catches any exception from its inner keywords. The exception is saved as $error
so that it can be used after the *Try
statement. This can then be used together with the *Assert
keyword to do negative testing.
Assert
The keyword *Assert
can be used to test reference values produced by *Try
or *GetValues
. The value can be testing by using one or more conditions.
The assert condition is specified in the format:
[<reference name>[reference index]<operator>(<group index>)]
Value | Description | Example |
---|---|---|
<reference name> | The name of the reference. | $error, $portfolio_id |
[reference index] | If the reference has more than one value. An index can be added to specify one of them. If no index is set, the condition must match all values. | [0], [1], [2] |
<operator> | The operator defines how the value should be tested. Any of the operators in the table below can be used. | =, <>, <, >, <=, <, >=, %, !% |
(<group index>) | Group index can be added to have OR between conditions. Conditions in the same group are joined by AND while conditions in different groups are joined by OR. If no group is specified, the conditions are joined by AND. | (0), (1), (2) |
The assert keyword can utilize the same operators as the *Filter
keyword, see here Filter Keyword for more details.
WhileIf, Then and Else
This group of keywords is used to specify actions depending on certain conditions.
*WhileIf
starts a loop that checks certain conditions continuously until the conditions are fulfilled or the loop times out. In order to get updated values, data processing runs a query using the fields taken from the immediate outer *Query
block. This means that *WhileIf
must be placed inside a *Query
function.
The conditions to be checked are the arguments sent to *WhileIf
. As with arguments in keywords *Query
and *Filter
, the conditions can have the relations AND and OR.
The value in the cell under the keyword contains the checking frequency and the total duration. This is written in the format <frequency>, <total time>
, where the frequency and total time are separated by a comma (,). Both frequency and total time consist of integers followed by characters that indicate the unit. For example, 15s,1m
means “check the condition every 15 seconds for 1 minute.
If the condition/s are fulfilled, data processing will find the key word *Then
and execute the functions in that block. If the loop times out, it will find the keyword *Else
and execute the functions in that block.
The figure below illustrates the use of these keywords. The *WhileIf
checks the state of the transaction. If it is in Verify, then it executes functions in block *Then
. If not, it looks to see if the running time is still within 1 minute. If it is, then it goes back to *WhileIf
and waits for 15 seconds until checking the condition again. If the running time is already more than 1 minute, it executes the functions in block *Else
.
Stop
This keyword is used to stop a row, a header, or a worksheet. To define what to stop, type one of the following words in the cell under the keyword:
Value | Action |
---|---|
Row or R | Stop the data row |
Header | Stop the header row |
Worksheet or W | Stop the worksheet |
Task or T | Stop the task |
Leaving the cell empty means do not stop.
Pause
This keyword is used to pause a task for a certain time frame. The duration of the pause is defined in the cell under the keyword, which consists of an integer followed by a case-sensitive character to represent the unit. For example, “10s” means “pause for 10 seconds”. The available characters are: s for seconds, m for minutes, and h for hours.
Updated over 2 years ago