web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to reliably filter...
Power Apps
Unanswered

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

(0) ShareShare
ReportReport
Posted on by 241

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?

Categories:
I have the same question (0)
  • v-xida-msft Profile Picture
    on at

    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,

  • MrNappa Profile Picture
    241 on at

    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.

  • v-xida-msft Profile Picture
    on at

    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, 

  • MrNappa Profile Picture
    241 on at

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard