# Expressions

With expressions is possible to use logical syntax, like we do in SQL, to filter any resource response.

One easy example could be (assuming that we are querying Voyage endpoint):

* **voyageResult > 1000 and voyageHeader.voyageStatus.statusTypeCode= 'FIN'**

Bit more complex one could be:

* **vessel.vesselName ='Borg 1' and (voyageHeader.operator = 999999 or voyageHeader.charteringResponsible = 999999 or voyageHeader.accountantResponsible= 999999)**

That introduce a completely new possibility, the usage of **parenthesis.**

It is possible to have any level of nested parenthesis:

* **(voyageHeader.operator != 999999 and ((voyageResult > 10000 and voyageHeader.voyageStatus.statusTypeCode= 'FIN') or (voyageResult < 10000 and voyageHeader.voyageStatus.statusTypeCode= 'NOM')))**

Support for **between** operator:

* **voyageResult between 1000 and 2000**

The dates in the expression must be preceded by the character **$**

* **voyageHeader.voyageStartDate > $2020-12-29T17:02:21**

To get all the voyages of the master scenario:

* **(voyageHeader.voyageStartDate>=$2021-01-14T17:02:21 and fleetPlanVoyages.fleetPlan.fleetPlanCode='MASTER') or (scenarios.scenarioCode='MASTER' and voyageHeader.voyageStatus.statusTypeCode= 'SCU')**

Supported Operators (all the operator are case sensitive):

| **Operator**       | **Description**       | **Note**                                                            |
| ------------------ | --------------------- | ------------------------------------------------------------------- |
| =                  | equal to              | ​                                                                   |
| !=                 | not equal to          | ​                                                                   |
| >                  | greater than          | ​                                                                   |
| >=                 | greater than equal to | ​                                                                   |
| <                  | less than             | ​                                                                   |
| <=                 | less than equal to    | ​                                                                   |
| between            | between               | ​                                                                   |
| not between        | not between           | ​                                                                   |
| in                 | in                    | ​                                                                   |
| not in             | not in                | ​                                                                   |
| like               | like                  | % must be encode with %25                                           |
| not like           | not like              | ​                                                                   |
| likeIgnoreCase     | like ignore case      | ​                                                                   |
| not likeIgnoreCase | not like ignore case  | ​                                                                   |
| !                  | negation              | on Vessel resource: ! (hasGrabsOnboard = false and iceClass = null) |

The expressions can be used in any resource of the data model.

The expression can be passed or through the URL query parameter called **expression (**&#x72;emember to encod&#x65;**):**

* ws/rest/Voyage?**expression**=vessel.vesselName='Borg 1' or voyageResult between 10 and 10000

or through the HTTP header parameter called **expression.**

The expression can be used in combination with sorting and pagination through URL query parameters.

Calculated fields cannot be used within the expressions.


---

# 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://api.dataloy.com/api-release-8.25/user-guides/enterprise-functionality/expressions.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.
