cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic @UI.Hidden in CDS Annotations

pmcfarling
Participant

Does anyone know how to dynamically set the @UI.Hidden annotation using CDS Annotations? I can do it with XML Annotations (<Annotation Term="UI.Hidden" Path="anXfeld">) and it works perfectly. Can't figure out how to do it with CDS. Seems @UI.Hidden can't use a path?

<Annotations Target="Metadata.xDSNxC_CM_CONTType">
    <Annotation Term="UI.FieldGroup" Qualifier="cont_checkboxes">
     <Record Type="UI.FieldGroupType">
      <PropertyValue Property="Data">
       <Collection>
        <Record Type="UI.DataField">
         <PropertyValue Property="Value" Path="fundingcontrol"/>
         <PropertyValue Property="Label" String="Funding Control"/>
        </Record>
        <Record Type="UI.DataField">
         <PropertyValue Property="Value" Path="extfundingsource"/>
         <PropertyValue Property="Label" String="Ext Funding"/>
         <Annotation Term="UI.Hidden" Path="fundingcontrol"/>
        </Record>
       </Collection>
      </PropertyValue>
     </Record>
    </Annotation>
   </Annotations>
View Entire Topic
0 Kudos

If you're using the CAP framework, it should look like this:

Note that it will only accept a boolean field.

FieldGroup #General : {Data : [
        {
            Value : AUART,
            Label : '{i18n>AUART}'
        },
        {
            Value : VKORG,
            Label : '{i18n>VKORG}',
            ![@UI.Hidden] : IsActiveEntity
        },
        {
            Value : VTWEG,
            Label : '{i18n>VTWEG}'
        },
        {
            Value : SPART,
            Label : '{i18n>SPART}'
        }
    ]},


hatrigt
Participant
0 Kudos

briannicholas May I know from where we can set the flag in IsActiveEntity?

For me, In CAP application, I have list report in which I have to hide a column based on the value derived in CAP Service implementation JS file. Any Idea how can we achieve this?