cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GGBB
Helper I
Helper I

Filter gallery entries who aren't blank for specific column

Hello,

I am making an app that is suposed to allow users to have acces to the folders they have the rights for.

 

In my case, I have folders in a sharepoint Documents library: "Chantier 1", "Chantier 2" and "Chantier 3" (Filter is used to simulate folders and subfiles)

I created a sharepoint list to manage access (A or B, I'd prefer A but I don't know which one would be best for powerapps to works)

I have 2 Users, (User1, User2), and an "X" indicate if they have the rights (User1 can access Chantier 1 and 3 while User2 can access Chantier 2 and 3)

 

I'm looking for a way to only show in my gallery folders who aren't blank in my sharepoint list for a specific user, the result should be like the 2 exemples at the botom of my pic (I'd like it to be "global" as I will have more users and more folders)

 

 

GGBB_0-1611919580613.png

Thanks for your help

1 ACCEPTED SOLUTION

Accepted Solutions

@Eelman 

 

As a matter of fact, your soltion got me thinking and I found how to do it in an even simpler way for the userc.jpgHere's my solution, I created a multiple choice column in my sharepoint list (Chantiers) with each folder as a proposition (Chantier 1; Chantier 2; Chantier 3;...)

My first gallery is looking up for the choices selected for the current user based on his Email (Lower is because some adresses use capital letters) and is displaying its value in the text

The second gallery is using this selected value to complete the path of the folder.

 

Thanks a lot anyway

View solution in original post

4 REPLIES 4
Eelman
Community Champion
Community Champion

@GGBB 

Personally, I'd manage access with a List schema setup like this, ie Option "C"

 

User || Fonction || Folder

 

This would be easier to manage IMO.

 

You could then set your app up in the following way (Note: my code uses different language settings to to you so you will need to adjust it for that:

 

In the App OnStart add

Set(vUser, User())

 

Then, on your gallery screen add a Flexible Height gallery with the Items code set as

Filter(Documents, User = vUser.FullName)

Note: User is a Single Line of text field in your List and holds the FullName (matching) of your users.

 

The Flexible Height gallery will collapse and expand to suit user access as it changes.

 

GGBB
Helper I
Helper I

Hi,

thanks for your help.

I set v.User in the App OnStart and added the flexible height gallery but it doesn't seem to work, the gallery stays blank

c.jpg

I don't understand how you make the connection between the datasource of the gallery (Documents) and the sharepoint list (Attribution) that I want to use to filter the results.

Eelman
Community Champion
Community Champion

@GGBB 

Ah sorry, you are correct. I rushed my response and didn't quite think it through. Firstly though, you need to correct you reference table in that there should only be one Folder column, not a column for each folder, eg

 

John Doe   RA.  Chantier 1

John Doe   RA.  Chantier 3

Alex Lee.    OP.   Chantier 2

Alex Lee.    OP   Chantier 3

 

Then, in the App OnStart and after setting the User variable, add this

ClearCollect(userFolders, Filter(yourListName, User = vUser.FullName))

 

Then the gallery Items could be set to

Filter(Documents, folderColumnName in userFolders.FolderCol)

 

This will likely throw a delegation warning, however, unless you plan on using 2000+ folder names it shouldn't be an issue.

 

@Eelman 

 

As a matter of fact, your soltion got me thinking and I found how to do it in an even simpler way for the userc.jpgHere's my solution, I created a multiple choice column in my sharepoint list (Chantiers) with each folder as a proposition (Chantier 1; Chantier 2; Chantier 3;...)

My first gallery is looking up for the choices selected for the current user based on his Email (Lower is because some adresses use capital letters) and is displaying its value in the text

The second gallery is using this selected value to complete the path of the folder.

 

Thanks a lot anyway

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Users online (2,566)