cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Hiding records based on conditions

Hi

 

I am creating an App for time tracking of my team. The Data source is an excel table.

In the sheet I have a column for username.

 

Now my app is ready and I want to share it with team.

The only issue is that I want my team to see only their time entries, hence I want to hide rows If current user is not same as the username mentioned in the record.

 

 

I put formula is in the visible property of the browseGallery of browseScreen as "If(BrowseGallery1.Selected.Name=User().FullName, true , false )"

But there is no luck I see all the records.

 

As you can see the attached screenshot, I am doing a simple app as Mobile interface from excel.

 

I didn't find any clue on Google or youtube.

 

Can you guyz help me

 

Thanks

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted

Hi @Vijayendra 

It sounds like you want to filter your list based on the User. This will only show entries that the current logged in user matches the name in your table.   If this is the case, you want to have the Items property of the Gallery as 

Filter(yourtable, usernamecolumn=User().FullName)  

If you have a column for Email addresses, you could use this as an alternative filter with User().Email

FYI, it is a common problem that the data in your column in the Excel table may contain spaces either before or after the name.  To make sure that you correctly capture the name, you may need to use Trim(usernamecolumn)=Trim(User().FullName).  As @mdevaney mentioned in a recent post https://powerusers.microsoft.com/t5/Building-Power-Apps/Filter-PowerApp-by-ME/m-p/577569#M180067  , it is usually better to use User().Email since these are unique and names can be duplicates.  

View solution in original post

Highlighted

Hi @Vijayendra,

 

Do like this it is much effective and easy also:

Step1: You refresh the data source:

Refresh DataSource.png

Step 2: Select the screen set variable in onvisible property as set(varUser,User())
Steps2: Change your query as below:

Filter('Employee Details',Email=varUser.Email) // This will also avoid the delegation issue.

Step3: View the sample results with the following step shown in the screen shot.

Filter query.png

 

I hope this resolved your issue if you see any challenge let me know I am always happy to help.

 

Regards,

Krishna
If this post helps give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

7 REPLIES 7
Highlighted
Super User III
Super User III

Hi @Vijayendra ,

 

Change the formula as below:

If(Subtitle13.Text = User().FullName,true,false)
In the above formula Subtitle13 is the control as part of the gallery displays the user full name, So I request you to replace your control name accordingly.

 

I hope this resolved your issue if you see any challenge let me know I am always happy to help.

 

Regards,

Krishna
If this post helps give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.
Highlighted

Hello @KrishnaV ,

 

Thanks for the suggestion.

unfortunately, It didn't work.

 

Please check the screenshot.

You can see Body2 displays the username

 

thanks

Highlighted

@KrishnaV 

 

I tested, It looks like it is taking the Body2 value for the first record only.

 

Body2.text = ThisItem.Name

 

While in the add screen , I have Name.text = User().Fullname

 

 

Highlighted

Hi @Vijayendra 

It sounds like you want to filter your list based on the User. This will only show entries that the current logged in user matches the name in your table.   If this is the case, you want to have the Items property of the Gallery as 

Filter(yourtable, usernamecolumn=User().FullName)  

If you have a column for Email addresses, you could use this as an alternative filter with User().Email

FYI, it is a common problem that the data in your column in the Excel table may contain spaces either before or after the name.  To make sure that you correctly capture the name, you may need to use Trim(usernamecolumn)=Trim(User().FullName).  As @mdevaney mentioned in a recent post https://powerusers.microsoft.com/t5/Building-Power-Apps/Filter-PowerApp-by-ME/m-p/577569#M180067  , it is usually better to use User().Email since these are unique and names can be duplicates.  

View solution in original post

Highlighted

Hi @Vijayendra,

 

Do like this it is much effective and easy also:

Step1: You refresh the data source:

Refresh DataSource.png

Step 2: Select the screen set variable in onvisible property as set(varUser,User())
Steps2: Change your query as below:

Filter('Employee Details',Email=varUser.Email) // This will also avoid the delegation issue.

Step3: View the sample results with the following step shown in the screen shot.

Filter query.png

 

I hope this resolved your issue if you see any challenge let me know I am always happy to help.

 

Regards,

Krishna
If this post helps give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

Highlighted

Thanks @KrishnaV and @Drrickryp 

Your suggestions are helpful,

I could filter my list.

 

Please help me more with sort.

But I am adding a new post because it is another problem

 

 

Highlighted

Hi @Vijayendra ,

 

I am very glad that I can help you, please don't forget to mention me as @KrishnaV when you log the issue (this will prompt me directly so I can help you fast).

 

Regards,

krishna


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (11,885)