Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add $Null() as value alternative #1361

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions advanced/odata.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,14 +336,16 @@ Primitive annotation values, meaning Strings, Numbers, `true`, and `false` are m
<Annotation Term="Some.String" String="foo"/>
```

Rendering a `null` value must be done as dynamic expression or as an [annotation expression](#expression-annotations):
#### Null Value { #null-value }

A `null` value can be set either as an [annotation expression](#expression-annotations) or as a [dynamic expression](#dynamic-expressions):

```cds
@Some.Null: { $edmJson: { $Null } }
// or
@Some.Null: (null)
@Some.NullXpr: (null) // annotation expression, short form
@Some.NullFunc: ($Null()) // annotation expression, functional form
@Some.NullDyn: { $edmJson: { $Null } } // dynamic expression
```
Both result in the following:
All three expressions result in the following rendering:
```xml
<Annotation Term="Some.Null">
<Null/>
Expand Down Expand Up @@ -662,7 +664,8 @@ The following operators and clauses of CDL are supported:
* Logical: `and`, `or`, `not`
* Relational: `=`, `<>`, `!=`, `<`, `<=`, `>`, `>=`, `in`, `between ... and ...`
* Unary `+` and `-`
* Arithmetic: `+`, `-`, `*`, `/`, `||`
* Arithmetic: `+`, `-`, `*`, `/`
* Concat: `||`
Copy link
Contributor Author

@hjboth hjboth Oct 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be exact, || is not an arithmetic operator...

* `cast(...)`

Example:
Expand Down Expand Up @@ -718,7 +721,7 @@ service S {

In addition, the following functions are supported:

* `$Null()` representing the `null` value
* `$Null()` representing the `null` value [`Null`]([annotation expression](#null-value)).
* `Div(...)` (or `$Div(...)`) and `Mod(...)` (or `$Mod(...)`) for integer division and modulo
* [`Has(...)`](https://docs.oasis-open.org/odata/odata/v4.02/csd01/part2-url-conventions/odata-v4.02-csd01-part2-url-conventions.html#Has) (or `$Has(...)`)
* the functions listed in sections
Expand Down