Expressions

In this section, you will learn about Open Loyalty language and more complex campaign conditions.

Introduction to Open Loyalty Language

When setting up conditions and effects for rules in Campaigns, you may find that some situations are not covered by premade values. However, you are not limited to using these values - you can use an Open Loyalty language to create very specific conditions and values. In conditions, you can find a condition called Expressions.

You can set the value of such an expression. It can be set as a combination of attributes and operators using the meta language created by Open Loyalty. It allows you to create a fully customizable condition that meets the rules of your planned loyalty program.

For example, you can create a campaign that is triggered when a customer buys a product from a certain category. You can do it in two ways:

Set a premade condition:

Or use an expression:

In the same way, you can create custom campaign effects - you can use premade values, or enter them yourself:

In this section, you will find a description of the meta-language together with all the supported syntaxes, which is based on the expression syntax of Symfony Expression.


The component supports

  • strings - single and double quotes (e.g. 'hello')

  • numbers - integers (e.g. 103), decimals (e.g. 9.95), decimals without leading zeros (e.g. .99, equivalent to 0.99); all numbers support optional underscores as separators to improve readability (e.g. 1_000_000, 3.14159_26535)

  • arrays - using JSON-like notation (e.g. [1, 2])

  • hashes - using JSON-like notation (e.g. { foo: 'bar' })

  • booleans - true and false

  • null - null

  • exponential - also known as scientific (e.g. 1.99E+3 or 1e-2)

Last updated