UI5 / UI5/openui5

sap.ui.export.Spreadsheet: support server-side flattening by only counting hierarchical level

Open
#3,347 6 comments 0 reactions 1 assignee View on GitHub

@simlin is already working on this.

Since Nov 5, 2021.

enhancement in progress
Dominant language
JavaScript
Stars
3.3k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

The progress and next $skip value is determined on the total amount of records and the records returned by each data received event. Basically sap.ui.export.Spreadsheet currently only supports what you see is what you get; the count you provide needs to count the total records and not just level 0. But that is a problem: it means you need to know the total count of an m:n relationship upfront. In our implementation, this is really not achievable. I only know the count of level '0', but my data source will return multiple levels.

I have currently solved this by extending sap.ui.export.Spreadsheet, sap.ui.export.SpreadsheetExport and sap.ui.export.DataProviderBase to only count elements that have level === '0'.

It would be nice to make this configurable in the standard via a property dataSource.countLimitedToLevel.
The implementation of DataProviderBase.prototype.fnOnDataReceive can check for workbook.hierarchyLevel and in that case only count those that match dataSource.countLimitedToLevel:

iFetchedRows = this.mSettings.dataSource && this.mSettings.dataSource && this.mSettings.dataSource.countLimitedToLevel && this.mSettings.workbook && this.mSettings.workbook.hierarchyLevel ? aData.filter((o) => o[this.mSettings.workbook.hierarchyLevel] === this.mSettings.dataSource.countLimitedToLevel).length : aData.length

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.