cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AraSaber12
Level 8

Provide access to some users

Hi Guys,

 

I have a table from SQL server called Employee. In this table i have a column called EmployerID and this column included 5 different values. 

 

In my app i have a Gallery which`s included all employees of the 5 employer. I created in the login screen 5 users accounts. My question is that each user can only see the employees which`s EmployerID is belongs too. 

 

So for example if user A want to loging that he only can see the employees of his company (EmployerID) in the gallery. 

 

Thank you so much!

 

2 REPLIES 2
Community Support Team
Community Support Team

Re: Provide access to some users

Hi @AraSaber12 ,

Could you please share a bit more about the data structure of your Employee Table?

Could you please show more details about the 5 users account?

Based on the needs that you mentioned, I think the Filter function could achieve your needs. I have made a test on my side, please take a try with the following workaround:

Set the Items property of the Gallery control to following:

Filter(
'[dbo].['YourSQLTable']',
EmployerID = "The EmployerID value captured from current sign in user"
)

Note: I assume that you could obtain the EmployerID value of the current sign in user.

 

E.G. I assume that you store the 5 users accounts within your app as below:

Set the OnStart property of your app or the OnVisible property of the first screen to following:

ClearCollect(
             UserAccounts,
             {UserName: "UserA", EmployerID: "1001"},
             {UserName: "UserB", EmployerID: "1002"},
             {UserName: "UserB", EmployerID: "1003"},
             {UserName: "UserB", EmployerID: "1004"},
             {UserName: "UserB", EmployerID: "1005"}
)

Then modify the Items proeprty of the Gallery to following:

Filter(
       '[dbo].['YourSQLTable']', 
        EmployerID = LookUp(UserAccounts, UserName = User().FullName).EmployerID
)

More details about the Filter function in PowerApps, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup

 

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.
AraSaber12
Level 8

Re: Provide access to some users

Hi @v-xida-msft ,

 

Thank you for your response! I will show you more details about my case.

 

First of all I created the usernames and passwords in my SharePoint. see you below. 

Untitled1.png

And this is my login screen how it looks like.Untitled.png

 

And this is how my gallery looks like.

Untitled2.png

 

So could you please tell me what can i do to fix this?

 

Best Regards!

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (3,764)