@@ -542,7 +542,7 @@ The second example is for a (record type) term in the [Communication vocabulary]
542542```
543543
544544
545- ### Expressions < Beta /> { #expression-annotations }
545+ ### Expressions { #expression-annotations }
546546
547547If the value of an OData annotation is an [ expression] ( ../cds/cdl#expressions-as-annotation-values ) ,
548548the OData backend provides improved handling of references and automatic mapping from
@@ -681,12 +681,54 @@ Instead of relying on this copy mechanism, you can also explicitly annotate a fo
681681annotate Books:author.ID with @Common.Text: ($self.author.name); // here $self is necessary
682682```
683683
684- ::: warning Restriction concerning the foreign key elements of managed associations
684+ A path that addresses a key element in the target of a managed association is always rewritten
685+ to address the local foreign key element.
685686
686- In an expression-valued annotation, it is not possible to reference the foreign key element
687- of a managed association.
687+ Example:
688+ ``` cds
689+ service S {
690+ entity Travels {
691+ key id : Integer;
692+ status : Association to TravelStatus;
693+ };
694+ entity TravelStatus {
695+ key code : String(1) enum {Open = 'O'; Accepted = 'A'; Canceled = 'X'; };
696+ }
697+ @UI.CreateHidden : (travel.status.code != #Open) <!-- [!code highlight] -->
698+ entity Bookings {
699+ key id : Integer;
700+ travel : Association to Travels;
701+ }
702+ }
703+ ```
704+
705+ Resulting OData API:
706+ ``` xml
707+ <Schema Namespace =" S" >
708+ <!-- ... -->
709+ <EntityType Name =" Travels" >
710+ <!-- ... -->
711+ <NavigationProperty Name =" status" Type =" S.TravelStatus" />
712+ <Property Name =" status_code" Type =" Edm.String" MaxLength =" 1" /> <!-- [!code highlight] -->
713+ </EntityType >
714+ <EntityType Name =" TravelStatus" >
715+ <!-- ... -->
716+ </EntityType >
717+ <EntityType Name =" Bookings" >
718+ <!-- ... -->
719+ <NavigationProperty Name =" travel" Type =" S.Travels" />
720+ </EntityType >
721+ <Annotations Target =" S.Bookings" >
722+ <Annotation Term =" UI.CreateHidden" >
723+ <Ne >
724+ <Path >travel/status_code</Path > <!-- [!code highlight] -->
725+ <String >O</String >
726+ </Ne >
727+ </Annotation >
728+ </Annotations >
729+ </Schema >
730+ ```
688731
689- :::
690732
691733#### Expression Translation
692734
0 commit comments