Conversation
agoerler
left a comment
There was a problem hiding this comment.
Please introduce in smaller steps
- one case
- multiple cases
- error function
cosider using ? :
Please add some examples for moderately more complex expressions.
Like, e.g.
- "if an order has items the order's total amount must be larger then 0"
- "a book's author's name must not be null"
Co-authored-by: Adrian Görler <adrian.goerler@sap.com>
What exactly do you mean with We agreed with Johannes and Patrice yesterday that we will keep the expressions simple here and wait for the CXL docs. But I can check for a "moderately more complex expression". |
I think @agoerler meant that we split up this single block into 3 examples. After each example we explain the nature of the used expression. |
Yes, I have split up the examples already. But was not sure if |
patricebender
left a comment
There was a problem hiding this comment.
👍 As Adrian stated, it would be nice to have a little more (complex) real life scenarios. I would have probably taken the well known Bookshop for showcasing the different scenarios. But that may be my personal taste.
You can use the ternary operator as syntactic sugar for the clumsy > cds.parse.xpr`1 > 2 ? true : false`
[
'case', 'when',
{ val: 1 }, '>',
{ val: 2 }, 'then',
{ val: true }, 'else',
{ val: false }, 'end'
] |
@patricebender - could you also omit the
|
That makes sense. When I tested it, compiler still required the default |
Co-authored-by: Patrice Bender <patrice.bender@sap.com>
I have improved the examples to use Bookshop related entities. Regarding the ternary operator, we still have to put the |
|
I would like to suggest that you introduce a few sub-sections for
|
Describes the basic feature set of the new
@assertannotation. The full blown CXN documentation is pending and will be provided by Patrice later. Once available, we will link it here. That´s why the expressions in the examples are kept simple by intention.