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

Re: Hiding records based on conditions

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
Resident Rockstar
Resident Rockstar

Re: Hiding records based on conditions

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.

View solution in original post

7 REPLIES 7
Highlighted
Resident Rockstar
Resident Rockstar

Re: Hiding records based on conditions

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.

Highlighted
Frequent Visitor

Re: Hiding records based on conditions

Hello @KrishnaV ,

 

Thanks for the suggestion.

unfortunately, It didn't work.

 

Please check the screenshot.

You can see Body2 displays the username

 

thanks

Highlighted
Frequent Visitor

Re: Hiding records based on conditions

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

Re: Hiding records based on conditions

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
Resident Rockstar
Resident Rockstar

Re: Hiding records based on conditions

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.

View solution in original post

Highlighted
Frequent Visitor

Re: Hiding records based on conditions

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
Resident Rockstar
Resident Rockstar

Re: Hiding records based on conditions

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

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (8,518)