Skip to content

Toggle Visibility example: avoid using $not in dynamic expression #1834

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions advanced/fiori.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ Then define an `on` handler for serving the request:
```js
srv.on('READ', 'Configuration', async req => {
req.reply({
isAdmin: req.user.is('admin') //admin is the role, which for example is also used in @requires annotation
isNotAdmin: !req.user.is('admin') //admin is the role, which for example is also used in @requires annotation
});
});
```
Expand All @@ -511,8 +511,8 @@ Finally, refer to the singleton in the annotation by using a [dynamic expression

```cds
annotate service.Books with @(
UI.CreateHidden : { $edmJson: {$Not: { $Path: '/CatalogService.EntityContainer/Configuration/isAdmin'} } },
UI.UpdateHidden : { $edmJson: {$Not: { $Path: '/CatalogService.EntityContainer/Configuration/isAdmin'} } },
UI.CreateHidden : { $edmJson: { $Path: '/CatalogService.EntityContainer/Configuration/isNotAdmin'} },
UI.UpdateHidden : { $edmJson: { $Path: '/CatalogService.EntityContainer/Configuration/isNotAdmin'} },
);
```

Expand All @@ -521,8 +521,8 @@ The Entity Container is OData specific and refers to the `$metadata` of the ODat
:::details SAP Fiori elements also allows to not include it in the path
```cds
annotate service.Books with @(
UI.CreateHidden : { $edmJson: {$Not: { $Path: '/Configuration/isAdmin'} } },
UI.UpdateHidden : { $edmJson: {$Not: { $Path: '/Configuration/isAdmin'} } },
UI.CreateHidden : { $edmJson: { $Path: '/Configuration/isNotAdmin'} },
UI.UpdateHidden : { $edmJson: { $Path: '/Configuration/isNotAdmin'} },
);
```
:::
Expand Down