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
Super User
Super User

@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.

@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

View solution in original post

Helpful resources

Announcements
User Groups Public Preview

Join us for our User Group Public Preview!

Power Apps User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (60,675)