Expressions

The possibility to use expressions for making complex queries Is Coming Soon…. (5.31.0)

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

 

 

Operator

 

 

=

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 (remember to encode):

  • 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.