File disappears on reload

Hi,

I’m trying to upload a file but it disappears from the database connected object class when I refresh.

In more detail what I’m doing is loading all files linked to one object into a runtime only object class.

The user can then make changes on the objects in the runtime only object class, i.e. add, remove files.

When the user is ready to save the changes first all objects in the database connected object class that are linked to the same object as before are deleted. Then the files from the runtime only object class are persisted. In the dev tools it looks as if the files are added to the database connected object class.

When I add a file and save it, all looks fine. Then I refresh and the file that was in the database connected object class before disappears.

Seems like the persist all does not work for objects that were deleted from the database connected object class just before. And yes, I added 500 ms of sleep just to be sure…

Yes this issue resembles: Object in the database connected datasource is gone on solution refresh - #8 by user8 but I don’t understand why “pending deletion” should affect whether a file can be persisted.

And what would be an alternative way to achieve the same result?

Hi @Kajetan ,

To better understand the problem and help you resolve it, I have a couple of questions:

  1. Could you provide a screenshot of the filter settings on the datasource to which the files are initially uploaded?
  2. When you upload files, are they directly saved to the database-connected object class, or are they first uploaded to a runtime-only datasource and then persisted to the database?

Thank you!

Hi,

image

  1. The files are first uploaded to a runtime-only datasource and then persisted to a database-connected object class.

hi again,

I did some thinking and testing, leading me to the conclusion:

The bug is connected to me deleting objects from the database connected object class before persisting files to it. My idea behind doing this was to have both update and delete as one action, i.e. make all changes (including delete) to a runtime-only datasource and persist all changes from there.

Therefore a workaround is to split update and delete into two…

2 Likes