Skip to main content

Conditions and actions

Variables

You can use variables in decision tables, for example, $, "$1", $t.

Variable

Comment

Example

$

References an arbitrary element iterated over in a loop.

checkorderstatus.PNG

"$1", "$2", "$3", etc.

References one specific element at the first, second, third, an so on, place in a list. If the list has only one value, then "$1" works, but "$2" and "$3" don't, since they are referencing non-existing elements.

applyrulesonlyonorders.PNG

$t, $s, $p, $c

References an object from FA for which the rule is currently executed. For example, a transaction, a trade order, a security, a portfolio, or a contact. The object type must first be imported (the first highlight in the example picture), and then declared (the second highlight in the example picture), before it can be used in a rule.

tradeorderflow_table.PNG

Condition field

The table below describes the syntax to use in the decision table's CONDITION field with some simple examples (where $t references a transaction in FA).

Expression

Syntax

Comment

Example

Loop

forall(||){}

Iterates over each element in a comma-separated list.

forall(||){$t.getStatus() == $}

This example returns "true" if the transaction has any of the statuses in the list.

Loop

forall(&&){}

Iterates over each element in a comma-separated list.

forall(&&){$t.hasTag($)}

This example returns "true" if the transaction has all tags in the list.

Equality

==

Checks if something is equal to a value.

$t.getType().getTypeCode() == "$1"

True if the transaction type is equal to the value referenced by "$1".

Inequality

!=

Checks if something is not equal to a value.

$t.getType().getTypeCode() != "$1"

True if the transaction type is not equal to the value referenced by "$1".

Less than

<

Checks if something is less than a value.

$t.getTradeAmount() < "$1"

True if the transaction trade amount is less than the value referenced by "$1".

Greater than

>

Checks if something is greater than a value.

$t.getTradeAmount() > "$1"

True if the transaction trade amount is greater than the value referenced by "$1".

Less than or equal to

<=

Checks if something is less than or equal to a value.

$t.getTradeAmount() <= "$1"

True if the transaction trade amount is less than or equal to the value referenced by "$1".

Greater than or equal to

>=

Checks if something is greater than or equal to a value.

$t.getTradeAmount() >= "$1"

True if the transaction trade amount is greater than or equal to the value referenced by "$1".

Action field

The table below describes the syntax to use in the decision table's Action field with some simple examples (where $t references a transaction in FA).

Expression

Syntax

Comment

Example

Update object data

update(object);

Updates object's data for remaining rule checks in the same decision table. This enables the next rules in the decision table to react to the changes done in the previous action field.

update($t);

Updates the transaction object with the values set by previous action. Enables remaining conditions to react to the updated values. Please see the sample Calculate fees for transactions