cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
MrNappa
Level: Powered On

How to reliably filter Sharepoint documents for an entity in a canvas app?

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:

sp.png

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?

4 REPLIES 4
Community Support Team
Community Support Team

Re: How to reliably filter Sharepoint documents for an entity in a canvas app?

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,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MrNappa
Level: Powered On

Re: How to reliably filter Sharepoint documents for an entity in a canvas app?

Hi Kris, thanks for the reply.

 

> Could you please share a screenshot about the Delegation warning issue with your Filter formula?

dw2.png

> 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.
ds.png

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.

Community Support Team
Community Support Team

Re: How to reliably filter Sharepoint documents for an entity in a canvas app?

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, 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MrNappa
Level: Powered On

Re: How to reliably filter Sharepoint documents for an entity in a canvas app?

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.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,920)