Expression Operatoren

Vergleichsoperatoren

Die folgenden Operatoren vergleichen zwei Werte. Die Operatoren machen am meisten Sinn für numerische Vergleiche. Jedoch sind auch Vergleiche mit anderen Typen möglich.

Operator

XML

Beschreibung

Beispiel

Resultat

Operator

XML

Beschreibung

Beispiel

Resultat

==

 

Gleich

2 == 2

Wahr

!=

 

Nicht gleich

2 != 2

Falsch

>

>

Grösser als

2 > 2

Falsch

<

&lt;

Kleiner als

2 < 2

Falsch

>=

&gt;=

Grösser als oder gleich

2 >= 2

Wahr

<=

&lt;=

Kleiner als oder gleich

2 <= 2

Wahr

String Operatoren

Die folgenden Operatoren können für Zeichenketten verwendet werden. CI kennzeichnet jeweils die “Case Insensitive” Variante. Die anderen Methoden berücksichtigten Gross-/Kleinschreibung.

Operator

Synonym

Auch als Funktion https://encodo.atlassian.net/wiki/spaces/EB/pages/155385876

Beschreibung

Beispiel

Resultat

Operator

Beschreibung

Beispiel

Resultat

=%

BeginsWith()

Startet mit

'bla' =% 'b'

Wahr

%=

EndsWith()

Endet mit

'bla' %= 'a'

Wahr

%=%

Contains()

enthält

'bla' %=% 'la'

Wahr

~~

EqualsCI()

Gleich*

'bla' ~~ 'Bla'

Wahr

!~

NotEqualsCI()

Nicht gleich*

'bla' !~ 'Bla'

Falsch

~%

BeginsWithCI()

Startet mit*

'bla' ~% 'B'

Wahr

%~

EndsWithCI()

Endet mit*

'bla' %~ 'A'

Wahr

%~%

ContainsCI()

Enthält*

'bla' %~% 'LA'

Wahr

Arithmetische Operatoren

Für arithmetische Funktionen stehen folgende Operatoren zur Verfügung:

Operator

Beschreibung

Typen

Beispiel

Resultat

Operator

Beschreibung

Typen

Beispiel

Resultat

*

Multiplikation

Numerisch

2 * 2

4

/

Division

Numerisch

2 / 2

1

+

Addition

Numerisch, DateTime, TimeSpan

2 + 2

4

-

Subtraktion

Numerisch, DateTime, TimeSpan

2 - 2

0

^

Potenz

Numerisch

2 ^ 3

8

%

Modulo

Numerisch

3 % 2

1

Boolsche Operatoren

Folgende “verbindende” Operatoren stehen zur Verfügung:

Operator

XML

Beschreibung

Beispiel

Resultat

Operator

XML

Beschreibung

Beispiel

Resultat

&&

&amp;&amp;

und

true && false

Falsch

||

 

oder

true || false

Wahr

!

 

nicht

!true

Falsch

Regular Expressions

Operator

Beschreibung

Beispiel

Resultat

Operator

Synonym

Auch als Funktion

Beschreibung

Beispiel

Resultat

=@

Matches()

matches regular expression

'bla' =@ 'b*'

true

~@

MatchesCI()

matches regular expression CI

'bla' ~@ 'B*'

true

Siehe  für eine Beschreibung Muster-Syntax.

Null-handling

Use the following operators to test for and handle null values.

Operator

Synonym

Beschreibung

Typen

Beispiel

Resultat

Operator

Synonym

Beschreibung

Typen

Beispiel

Resultat

?

IsNull()

unary IS NULL

Any

?null

true

!?

IsNotNull()

unary IS NOT NULL

Any

!?null

false

??

Coalesce()

Null-coalescing

Any

null ?? 2

2

Type-casting

The type-cast operator allows an application to transform the type directly. Any number with a decimal point is automatically a floating-point number. Use the m suffix to make it the money type instead. For some other common types, there are standard functions that are more flexible than type-casting (see custom dates and time functions and custom Guid functions).

Operator

Beschreibung

Typen

Beispiel

Resultat

Operator

Beschreibung

Typen

Beispiel

Resultat

()

Type-cast

Typename, Any

(int)value

value (w/type 'int')

A product can create expressions that return specific types using the MetaType, as shown in the examples below.

Example

.NET Type of result

Example

.NET Type of result

(Boolean)'true'

bool

(Date)"2020-01-01"

DateTime

(DateTime)"2020-01-01 12:00:00"

DateTime

(Time)"15:14:13"

DateTime

(TimeSpan)"15:14:13"

TimeSpan

(TinyInteger)12

byte

(SmallInteger)12

short

(Integer)12

int

(LargeInteger)12

long

(Currency)12

decimal

(Double)12

double

(Guid)'D0A64D79-C2ED-470C-B8AF-4285C96AD415'

Guid

(Text)12

string

A product can also use any available, fully-qualified .NET type name, as shown in the examples below.

Example

Result

Example

Result

(System.DayOfWeek)5

DayOfWeek.Friday

(System.DateTime)"2020-01-01 12:00:00"

DateTime object representing "2020-01-01 12:00:00"

(System.TimeSpan)"15:14:13"

TimeSpan object representing "15:14:13"

Lists

Use the following operators with lists.

Operator

Beschreibung

Typen

Beispiel

Resultat

Operator

Beschreibung

Typen

Beispiel

Resultat

in

Containment

Any

Array

BereichID in [18, 19, 20]

1 in [1,2,3]

not in

Not in list

Any

!(BereichID in [18, 19, 20])

!(5 in [1,2,3])

List Operator

Several of the operators above can be applied to all elements of a list using a list operator. For example, the expression [+::1,1,2,3] evaluates to 1 + 1 + 2 + 3.

The following operators work with lists:

  • &&

  • ||

  • #

  • +

  • -

  • *

  • ^

Operator Precedence

Operator precedence is enforced with staggered productions in the grammar and consists of five precedence levels (from most-binding to least):

Level

Operators

Level

Operators

1

^#=>

2

*/%&&

3

+-, `

4

==!=~~!~<><=>=in%==%%=%%~~%%~%~@=@

5

??

The following examples show how precedence affects expressions and how to use parentheses to change the precedence.

Example

Result

Example

Result

1 + 1 * 2

3

(1 + 1) * 2

4

6 / 2 * 3

9

6 / (2 * 3)

1