SAP Fiori Elements with Annotation Expression
To note down annotation expression examples I have used and proved workable. Unfortunately, I didn't find any official documents so far. Will update here if I get any.
Apply a Function
A function can be used to calculate wanted value for a specified UI place. The example below is use 'odata.concat' to concatenate three fields with '-' as the separator, and display it as the title of the object page. Without this approach, backend service needs to add a dedicated field and do the concatenation at the backend. But I found that this doesn't work in DataField. I think the reason may be there is annotation ConnectedField for this purpose. This tested successfully with FE V2.
IF-ELSE
For some simple dynamic control cases, it is much easier to determine the result on the client side instead of the backend side. Below is an example of a general case that to display or hide a form group according to a field value. It evaluates a value from the field specified with tag 'Path', compares it to a string value specified with tag 'String'. The comparison operation can also be specified via different tags.
If the result is true, then return the first tag after comparison tag(''</Eq>"). Otherwise, return the second tag. Again, the advantage is saving a technical control field which previously need to be provided by backend service. This is tested successfully with FE V4.
Another example from CAP sample app:
Comments
Post a Comment