Skip to Content

Hide DataField in Fiori Elements using @UI.Hidden

Hello,

We're trying to hide a DataField in Fiori Elements using @UI.Hidden in our local annotation file, but it still shows up in our app. We've tried refreshing the browser and also logged in using Incognito-mode, but to no avail.

We've added the following to the annotation.xml

<Record Type="UI.DataField">
    <PropertyValue Property="Value" Path="attendees_number"/>
    <Annotation Term="UI.Hidden" Bool="true"/>
</Record>

Regards

Mattias

Add comment
10|10000 characters needed characters exceeded

  • Hi Mattias,

    Are you trying to hide the DataField of an annotations project in a SmartTable or SmartField?

    Kind Regards,

    Jahanvi

    External

    On behalf of SAP Product Support

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    Apr 12 at 07:33 AM

    We found the answer, we're on UI5 1.52, when running it on version 1.64 in the FLP sandbox it works, seems @UI.hidden is broken in 1.52.

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 12 at 07:08 AM

    Hi Mattias,

    If that is the case, you can try doing from UI5 custom code as well in controller extension.

    First get the entire model from your CDS and in object page, where you are showing the field group. Based on some flag, you can hide the field for certain data. In this case model will be same as coming from CDS or OData, but in UI layer you can hide it based on your condition. Hope I am understanding your requirement correctly.

    Regards,
    Tejas

    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      That would maybe work, but we're in the process of upgrading to the latest UI5 component anyway, we will leave this as-is for now, since we've tested it on the newer version and it works.

      Thank you for your help.

      Regards

      Mattias

  • Apr 11 at 08:36 AM

    Did you try removing the clone option, reclone Local annotation and try. Sometimes the changes are not reflected. Or for effective hiding, write the same in CDS, below @UI.lineitem

    Regards,

    Tejas

    Add comment
    10|10000 characters needed characters exceeded

    • It works fine when adding

      @UI.hidden: true

      in the CDS. However we would like to hide the field dynamically based on some custom logic. We're not aware of any way of doing this in the CDS. We therefore created a new virtual attribute in the CDS, which we want to use in the annotations XML file to control the visibility of the field.

  • Apr 11 at 09:14 AM

    For such logic you should handle in odata. Use SEGW project, create a CDS reference and modify the metadata based on the condition in your MPC or DPC class.

    Moreover do you want to say that for certain condition the whole report will not show the data field ? In List report, either you can hide the column for entire data (as datafield is nothing but a column in responsive table). If you want to modify the field in row level, i think you can still play with the data but not the column.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi, no, it does not, we're on Netweaver 7.50, so no drafts for us yet. But why would this be required to hide a field dynamically?

      Anyway the problem isn't the calculated property, but even if we put the following in our Annotations file it is not hidden, only if we do it in the CDS

      <Record Type="UI.DataField">
          <PropertyValue Property="Value" Path="attendees_number"/>
          <Annotation Term="UI.Hidden" Bool="true"/>
      </Record>