I have enabled sharepoint for a certain entity in my environment and added files to it. Now I want to display a list of files for a selected entity in my Canvas app.
My current (test) code looks something like this. I have added a CDS connector to the entity, as well as a CDS connector to Document Locations and SharePoint Sites, and a Sharepoint connector pointing to the entity base folder.
Now, after selecting an entity from a dropdown, I use the following code to determine the folder for the item:
UpdateContext({ documentlocation: First( Filter('Document Locations', Regarding=Dropdown1.Selected )) });
UpdateContext({ folder_base: "vdt_projectdefinitie/"&documentlocation.'Relative URL'&"/" });
UpdateContext({ folder_prefix: folder_base }); /* ideally used to navigate to subfolders later */
Then I added a Gallery with the Items property set to:
SortByColumns(Filter(Projectdefinitie, Mappad=folder_prefix), "{IsFolder}",Descending,"{FilenameWithExtension}",Ascending)
( "Mappad" is the localized "Folder Path" property )
After running a test, I saw that this will populate the gallery correctly filtered on the chosen entity:

But I still get a delegation warning so it wouldn't work on large data sets. The delegation warning not only applies to the filter on the folder path, but also on the sorting on the columns.
According to this post I dug up, the root cause seems to be the fact that said columns are calculated. But I'm not sure how to proceed from here. Any advice?