cancel
Showing results for 
Search instead for 
Did you mean: 

Analytical table based on CAP V4 service

MioYasutake
Active Contributor

Hi community,

I am trying to create a list report app with analytical table based on CAP OData V4 service (UI5 version: 1.109.0). My sample app is located in the Git repository below.

https://github.com/miyasuta/cap-analytical-table

I have referenced to the SAPUI5 SDK document (section "How to Annotate Your Service as an Analytical Service).

I have annotated my entity as below.

namespace my.bookshop;

entity Books {
  key ID : Integer @title: 'ID';
  title  : String @title: 'Title';
  category: String @title: 'Category';
  stock  : Integer @title: 'Stock';
  unit: String @title: 'Unit of Measure'
}

@Aggregation.CustomAggregate#stock : 'Edm.Decimal'
@Aggregation.ApplySupported: {
  GroupableProperties: [ID, title, category],
    Transformations: [
      'aggregate',
      'topcount',
      'bottomcount',
      'identity',
      'concat',
      'groupby',
      'filter',
      'expand',
      'top',
      'skip',
      'orderby',
      'search'
    ]
}
entity BooksAggregate as projection on Books {
  ID,
  title,
  category,
  @Analytics.Measure : true
  @Aggregation.default: #SUM
  stock,
  unit
}<br>

There are two issues now.

1. The measure field (stock) is empty on the list report.

$batch request is successful, but it doesn't seem to fetch quantity.

GET BooksAggregate?$count=true&$apply=groupby((ID,category,title))&$skip=0&$top=62 HTTP/1.1

2. If I try to apply grouping in the table setting, an error occurs.

Below is the query sent when grouping is applied.

GET BooksAggregate?$apply=concat(groupby((ID,category,title))/aggregate($count%20as%20UI5__leaves),groupby((category))/concat(aggregate($count%20as%20UI5__count),top(72))) HTTP/1.1

What is the minimum requirement to make analytical table work?

Update (2023/3/29) ------------------------------------------------------------------------------------

The second issue was resolved when I added the following code to package.json.

  "cds": {
    "features": {
      "odata_new_parser": true
    }
  }

"concat" feature is supported with experimental feature as described in the document.

Now it looks like below, but stock value is still missing.

----------------------------------------------------------------------------------------------------------------

Best regards,

Mio

yogananda
Product and Topic Expert
Product and Topic Expert

mioyasutake

Using cds.. there are lot of examples for building Analytical frameworks.. you must see this below link

https://ui5.sap.com/test-resources/sap/fe/core/fpmExplorer/index.html#/customElements/customHeaderFa...

Accepted Solutions (1)

Accepted Solutions (1)

MioYasutake
Active Contributor
0 Kudos

With @Aggregation.ApplySupported annotation only, the measure field is now displayed.

@Aggregation.ApplySupported
entity BooksAggregate as projection on Books {
  ID,
  title,
  category,
  @Analytics.Measure : true
  @Aggregation.default: #SUM
  stock,
  unit
}

But unfortunately, the totals line as we saw in v2 list report is not displayed. This holds true even after I apply grouping. Stock is not aggregated based on the grouping criteria.

MioYasutake
Active Contributor
0 Kudos

In order to show the total, UI.PresentationVariant annotation is required.

annotate CatalogService.BooksAggregate with@(
    UI: {
          PresentationVariant: {
            Total: [
              stock
            ],
            Visualizations: [
              '@UI.LineItem'
            ]
          },

Answers (1)

Answers (1)

preethi_ande
Participant
0 Kudos

Hi Mio,

I have followed your blogs and tried to display total value.

But total value for integer property not showing in table. if i check in network $batch call is not happening for total, for groupby it is working fine.

I have added PresentationVariant and below code also

"features": {
"odata_new_parser": true
}

My ui5 application version is 1.108.0

kindly help on this issue.

Thanks,

Preethi

Meenakshin
Discoverer
0 Kudos

Hi, did you find any solution for this? I have followed the blog and did everything as mentioned, but totals are not displaying