# Complex Effects (if, else)

We want to set the the granted points to twice the amount member spent in transaction that triggered the campaign. We also want to set a point limit for transaction to 100 - we want to avoid the situation when the member spends a lot in one transactions, and gets more points than he can spend for the rewards. \
\
We can use Open Loyalty language, and set following effect:

```
(transaction.grossValue * 2 >=100) ? 100 : transaction.grossValue * 2
```

Which means that if the transaction value multiplied by two is smaller or equal 100, than user will get the multiplied value of points, if it is bigger - user will always get 100 points. \
\
This way, we can create a campaign that is triggered by all transactions, but all transactions above the 50 value will result in 100 points given to the user.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.openloyalty.io/main-features/expressions/sample-use-cases/complex-effects-if-else.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
