cancel
Showing results for 
Search instead for 
Did you mean: 

Smart Chart Aggregation using XML Annotations

leonikussmaul
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Experts,

I am currently working with a Smart Chart control and experiencing some issues with the required annotations.

I am able to render the smart chart from the UI using xml annotations. However, the one thing that is missing here is to add the sap:semantics="aggregate" property to the entitySet, which is required in order to aggregate the values in my smart chart.

I have tried various ways of adding this property to the metadata, and have only managed via CAP CDS annotations. Then again, this seems to overwrite / conflict with the xml annotations and the smart chart no longer renders. I would prefer to use only XML annotations - so if someone knows how to add this specific property via XML, please let me know.

My CDS annotations were as follows

annotate service.opportunityHeader with @( Aggregation.ApplySupported : { PropertyRestrictions : true, Transformations : [ 'aggregate', 'topcount', 'bottomcount', 'identity', 'concat', 'groupby', 'filter', 'expand', 'top', 'skip', 'orderby', 'search' ], AggregatableProperties : [{ $Type : 'Aggregation.AggregatablePropertyType', Property : opportunityValue }], GroupableProperties : [ opportunityValue ] }

Would be great to hear some best practices when working with smart charts. Thank you!

View Entire Topic
yogananda
Product and Topic Expert
Product and Topic Expert
0 Kudos
leonikussmaul

Did you try this below link which provide some examples for chart ?

https://ui5.sap.com/test-resources/sap/fe/core/fpmExplorer/index.html#/buildingBlocks/chart/chartDef...

leonikussmaul
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thanks for your response - I will have a look at this again. Any idea how I can add sap:semantics="aggregate" using XML annotations instead, as everything else is working and rendering as expected using only XML annot. file?

Thanks again.

yogananda
Product and Topic Expert
Product and Topic Expert
0 Kudos

Here is example to use sap:semantics="aggregate"

<EntitySet Name="SalesOrders" EntityType="SalesOrder">
  <NavigationPropertyBinding Path="SalesOrderItems" Target="SalesOrderItems"/>
  <Annotation Term="Org.OData.Capabilities.V1.FilterRestrictions">
    <Record>
      <PropertyValue Property="Filterable" Bool="true"/>
      <PropertyValue Property="RequiredProperties">
        <Collection>
          <PropertyPath>Customer</PropertyPath>
          <PropertyPath>SalesOrderID</PropertyPath>
        </Collection>
      </PropertyValue>
    </Record>
  </Annotation>
  <Annotation Term="Org.OData.Capabilities.V1.AggregateRestrictions">
    <Record>
      <PropertyValue Property="Non-AggregatableProperties">
        <Collection>
          <PropertyPath>Customer</PropertyPath>
          <PropertyPath>SalesOrderID</PropertyPath>
        </Collection>
      </PropertyValue>
    </Record>
  </Annotation>
  <Annotation Term="Org.OData.Capabilities.V1.TopSupported"/>
  <Annotation Term="Org.OData.Capabilities.V1.SkipSupported"/>
  <Annotation Term="Org.OData.Capabilities.V1.CountRestrictions">
    <Record>
      <PropertyValue Property="Countable" Bool="true"/>
    </Record>
  </Annotation>
  <Annotation Term="Org.OData.Capabilities.V1.SelectSupport"/>
  <Annotation Term="Org.OData.Capabilities.V1.SearchRestrictions">
    <Record/>
  </Annotation>
  <Annotation Term="com.sap.vocabularies.Common.v1.Label" String="Sales Orders"/>
  <Annotation Term="com.sap.vocabularies.Common.v1.Text" Path="Description"/>
  <Annotation Term="com.sap.vocabularies.UI.v1.HeaderInfo">
    <Record Type="com.sap.vocabularies.UI.v1.HeaderInfoType">
      <PropertyValue Property="TypeName" String="SalesOrder"/>
      <PropertyValue Property="Title">
        <Record Type="com.sap.vocabularies.UI.v1.DataField">
          <PropertyValue Property="Label" String="Sales Order"/>
          <PropertyValue Property="Value" Path=""/>
        </Record>
      </PropertyValue>
      <PropertyValue Property="Description">
        <Record Type="com.sap.vocabularies.UI.v1.DataField">
          <PropertyValue Property="Label" String=""/>
          <PropertyValue Property="Value" Path=""/>
        </Record>
      </PropertyValue>
      <PropertyValue Property="ImageUrl" Path=""/>
    </Record>
  </Annotation>
</EntitySet>