Sometimes a Rule should be calculated only if a given condition is met. Alternatively, you may want a rule to apply only to a specific Entity or for a particular Time period. This can be achieved with a conditional IF statement.

The syntax for a conditional statement is:

If(Evaluation, Result if True, Result if False)

For example, we may want to test if the current entity is UK, if it is (i.e. True) then perform one calculation, if it’s not (i.e. False) then perform another calculation.

In order to perform a test we need to compare one value against another. This can be achieved by using a Logical Test Operator. These allow us to test if one value is equal to, greater than, less than, and so on compared to another value.

Here are the valid Logical Test Operators in Cubix.

Operator Description
== Equal to (note the use of double equals signs)
!= Not equal to
> Greater than
>= Greater than or equal to
< Less than
<= Less than or equal to

So an example might be to set a certain tax rate if the entity is UK. The rule might look as follows:

If (Entity==@UK, 20, 25)

If the entity is UK, then the tax rate is 20, otherwise it is 25.

Using the Logical OR and AND Operators

To provide conditional functions with greater flexibility, it is possible to test for multiple conditions rather than just one. Cubix uses the following operators to test for multiple conditions:

Operator Description
|| Logical OR. Will apply when either or any of the conditions are satisfied. That is, Cubix will return the True argument when any of the OR conditions are met.
&& Logical AND. Will apply only when all of the conditions are satisfied. That is, Cubix will return the True argument when all of the AND conditions are met.

Taking the above example, we may want our UK Tax Rule to use a different rate only in the Actual version compared to historical versions. The rule will require two conditions.
The rule statement would look as follows:

If (Entity==@UK && Version==@Actual, 20, 25)

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Please do not use this for support questions.
Centrixe Support

Post Comment