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?
Thanks. I've browsed through the posts in the ideas forum marked with relevant sharepoint tags, but couldn't find any, so I created one here.
Hi @MrNappa ,
Thanks for your feedback. I afraid that there is no direct way to achieve your needs in PowerApps currently.
If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:
https://powerusers.microsoft.com/t5/Power-Apps-Ideas/idb-p/PowerAppsIdeas
Best regards,
Hi Kris, thanks for the reply.
> Could you please share a screenshot about the Delegation warning issue with your Filter formula?
> Is the "Projectdefinitie" a SP library on your side?
It's the name of the SP data source. (It's the name of the entity for which Sharepoint was enabled in Dynamics -- after specifying a sharepoint URL, I chose this as 'list' from the options). I think it points to just the root folder for that entity in sharepoint.
> Actually, it is an known issue with the 'Folder Path' column in a SP Library. Currently, the 'Folder Path' field of a SP Library could not be delegated within a Filter function in PowerApps app currently.
Yeah, that's what I gathered (as stated in OP)... Do you know if this on the radar as something to be fixed/improved? Maybe a thread in the ideas/suggestions forum I can vote on? It really sounds as something that should work 'out of the box'...
>As an alternative solution, I think the collection could achieve your needs. [snip]
However, this would only remove the warning that the editor gives me. The underlying problem would remain. I don't know if (and if so, when) the customer would reach the maximum number of files, but once they do the app would show unexpected behavior.
Hi @MrNappa ,
Could you please share a screenshot about the Delegation warning issue with your Filter formula?
Is the "Projectdefinitie" a SP library on your side?
Actually, it is an known issue with the 'Folder Path' column in a SP Library. Currently, the 'Folder Path' field of a SP Library could not be delegated within a Filter function in PowerApps app currently.
As an alternative solution, I think the collection could achieve your needs. You could consider save your SP Library records into a collection in your app, then use the collection as data source in your app rather than original SP Library data source.
I have made a test on my side, please consider take a try with the following workaround:
Set the OnStart property of App to following:
ClearCollect(LocalSPLibrary, Projectdefinitie)
Set the Items property of your Gallery to following:
SortByColumns(
Filter(Projectdefinitie, 'Folder path' = folder_prefix),
"{IsFolder}", Descending,
"{FilenameWithExtension}", Ascending
)
or
SortByColumns(
Filter(Projectdefinitie, Mappad = folder_prefix),
"{IsFolder}", Descending,
"{FilenameWithExtension}", Ascending
)
then re-load your app (fire the OnStart property of App), check if the issue is solved.
Note: Please make sure you have set the "Data row limit for Non-delegable queries" option to maximum value -- 2000 within Advanced settings of App settings of your app.
Best regards,
WarrenBelz
146,658
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional