cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sudosaurus
Post Partisan
Post Partisan

SPO document library delegation not displaying documents in gallery

Hello,

 

I have a Power App where I have a list form with a column called "Contract No".

For example the "Contract No" could be "LWCM-01-04-2018-208" where 208 equals the list ID number.

 

For each list item created I also have a folder automatically created in a separate document library.

Each folder uses the same name as the "Contract No" column so I would have a folder named "LWCM-01-04-2018-208".

 

The contents of each folder is displayed next to the form depending on which item is opened.

 

We've recently gone over 500 documents in the document library (at top level) even though each sub-folder for each contract has about 5 files in each. It was brought to my attention that the more recent contracts that had been created were not showing their associated files - these had been added into SharePoint but were not displaying in PowerApps.

 

It dawned on me that in PowerApps that in settings, the Data Row Limit was set to 500. After increasing this to 2000, the documents started showing.

 

Now, I admit I'm no Power Apps pro, and I'm still learning the platform. I'm a little stuck as whilst I've temporarily solved the problem. When we eventually pass 2000 documents added to the document library, the Power App will stop showing documents again. 

How can I setup delegation on the document library so that these documents continue to be shown?

 

Thanks. 

7 REPLIES 7
StalinPonnusamy
Community Champion
Community Champion

Hi @sudosaurus 

We have some workaround to solve this issue which retrieves the documents multiple times and join together

 

Steps

  • Collects 2000 and store in a collection
  • Join the collections
  • Use Concurrent to improve performance

Example:

 

//Concurrent Request
Concurrent(
    ClearCollect(
    colMyRequests,
    Filter(
        DimCustomer,
        CustomerKey <= 2000
    )
),
ClearCollect(
    colMyRequests2000,
    Filter(
        DimCustomer,
        CustomerKey > 2000 && CustomerKey <= 4000
    )
)
,ClearCollect(
    colMyRequests4000,
    Filter(
        DimCustomer,
        CustomerKey > 4000 && CustomerKey <= 6000
    )
)
);

Collect(colMyRequests,colMyRequests2000,colMyRequests4000);

 

 

Note:

  • Now colMyRequests has all your documents
  • In this case, we have to know the maximum possible documents count, so that we can retrieve it multiple times

 

If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

KvB1
Solution Specialist
Solution Specialist

Hi,

 

The 2000 limit is the maximum amount of items powerapps can retrieve from sharepoint with one query. 

 

You can however get accurate results from large libraries, as long as you dont use queries that will return more than 2000 items.

 

To test this, I created a library with 67k files, a unique title, and some meta data that was shared between batches of files (for example, 74 files of the value 550921903 in Column x, which i can check by using the filter in sharepoint). In powerapps, when filtering the library for that value in column x, 74 items are returned as well.

 

If you just filter on folderpath (which is a native metadata field in powerapps for libraries) you should get results back without any issue 

 

 

 

 

 

StalinPonnusamy
Community Champion
Community Champion

Thanks for more information. We should not be having any issues when the filter query that result is less than 2000. So add some filters on the gallery screen to make sure to return fewer results.

 

Sample filter (Priority - Dropdown) and text search:

With(
    {sData: 'Issue tracker'},
    Search(
        Sort(
            Filter(
                sData,
                Priority.Value = Dropdown1.Selected.Value
            ),
            'Date reported',
            Descending
        ),
        TextSearchBox1.Text,
        "Title"
    )
)

 

Sample Lookup (Brings specific record)

LookUp('Issue tracker', ID=SelectedId)

 

sudosaurus
Post Partisan
Post Partisan

Hi @StalinPonnusamy and @KvB1 

 

Thanks for both of your responses.

 

This is the "Items" value for my gallery:

Filter(Contracts,'{Path}' = Concatenate("Contracts/",DataCardValue1.Text,"/"))

 

Where "Contracts" is the document library.

 

How would I add those filters into my current item value?

 

Just to get an idea of my app. On the left is the SharePoint list form and on the right is the folder that sits under the Contracts document library and then there is a gallery (Contract Documents) below this that shows the files for that specific contract.

 

sudosaurus_0-1627316391765.png

 

StalinPonnusamy
Community Champion
Community Champion

You should be having some unique id for each record then

In this example, ID is a unique key for the record

 

 

LookUp(Contracts, ID=Gallery1.Selected.ID)

 

 

The right approach is to set a unique record id whenever you selected gallery

 

Set(SelectedId, ThisItem.ID)

 

 

On the form item property

 

LookUp(Contracts, ID=SelectedID)

 

ID - My datasource unique Id/key. Replace your unique key

 

sudosaurus
Post Partisan
Post Partisan

I'm not sure where to put that in reference to what I already have?

KvB1
Solution Specialist
Solution Specialist

With the approach you used as you mentioned, you have the problem where files showed again after setting limit to 2000?

 

What you could try is add a column to your library with a ContractID, index the column, and filter the library on that rather than on the folder

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,799)