spreadsheetimporter / ui5-cc-spreadsheetimporter

A UI5 Component to integrate a Spreadsheet Upload for UI5 Apps.
https://spreadsheet-importer.com/
Apache License 2.0
75 stars 15 forks source link

[FEAT]: Transactional Import behavior (support) #515

Closed FrankVisuals closed 3 months ago

FrankVisuals commented 4 months ago

Description

We have implemented a custom import in our project as of right now, but would love to use a reuse library for it instead.

However, an important requirement is that either the full import fails or succeeds. If I understand the documentation correctly you are using the oData API to create the entities - meaning that the first batch of 1000 could work while the next one has errors, but the first entries would have already been inserted into the db.

As this is a pure frontend implementation I'm aware that this is nothing you can solve completely as part of this project. In our case we have a specific entity that "collects" the data in a json format before we run the import in the backend. So we would need to hook / overwrite the logic of how the data is sent to the backend. I suppose adding a way to overwrite this is not a major problem, but it would most likely break the entire error handling.

marianfoo commented 4 months ago

Hi @FrankVisuals thank you for opening the issue. It seems the requirements are not that easy. If you like we can discuss this in a personal meeting so I understand the use case better. Just send a email to marian@marianzeis.de Thanks!

marianfoo commented 3 months ago

Hi Frank, thank you for the meeting and opening the issue. Just for documentation here the suggestions:

If I understand the documentation correctly you are using the oData API to create the entities - meaning that the first batch of 1000 could work while the next one has errors, but the first entries would have already been inserted into the db.

The batch size can be changed to 0, then everything will be send at once. The backend is then able to either save all or nothing.
https://docs.spreadsheet-importer.com/pages/Configuration/#batchsize

As this is a pure frontend implementation I'm aware that this is nothing you can solve completely as part of this project. In our case we have a specific entity that "collects" the data in a json format before we run the import in the backend. So we would need to hook / overwrite the logic of how the data is sent to the backend. I suppose adding a way to overwrite this is not a major problem, but it would most likely break the entire error handling.

With the available events, mainly uploadButtonPress, it is possible to create your own creation logic. Here is a example to prevent the default creation logic and send the data to the backend as you like. https://docs.spreadsheet-importer.com/pages/Events/#example-2 For example, if the row size is too large and the data has to be transferred in batches, the already successful batches can be reset or deleted in this event if an error occurs

You can also the Spreadsheet Importer as Framework and with standalone Mode using it without a OData Service and also implement your own creation process.

If you need more events or hooks or may need a feature to better integrate into your use case, your are more than welcome to open a new issue.

Regards