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

Filter in gallery on creators email with OR?

Hi,

 

I have a gallery view in a powerapp that show some records created by different users. I have received a request to only show the records that the current user created. No problem in that BUT I have one user that should be able to see the records for all users. For that I wanted to use an OR in the filter, but I cannot get it to work. 

The filter on current user that works:

 

SortByColumns(Filter([@'Kantineformular Liste2']; Udfyldt_Af_Email=User().Email && StartsWith(Title; TextSearchBox1.Text)); "Created"; If(SortDescending1; Ascending;Descending ))

 

The one with the extra email added to see all(doesn't work)

 

SortByColumns(Filter([@'Kantineformular Liste2']; (Udfyldt_Af_Email=User().Email Or User().Email="someuser@company.com") && StartsWith(Title; TextSearchBox1.Text)); "Created"; If(SortDescending1; Ascending;Descending ))

 

 

I tried with different formatting but alas.

 

Hope someone can help:)

2 ACCEPTED SOLUTIONS

Accepted Solutions
CamiloLuque
Advocate I
Advocate I

Hi @DSKJ, If your second user must see all records, why you use a filter for this user?. Before filter you can validate what user is and use a filter or not.

The formula with the extra email doesn't work because User().Email is not a column, you must use a column name to filter a table.

View solution in original post

DSKJ
Frequent Visitor

Based on the help I got I now have it working. Maybe it's crude and could be optimized but it works and my dataset is very small 🙂

Here's an anonymized version to help other people:

If(User().Email="someuser@comecompany.com";
    SortByColumns(Filter([@'Kantineformular Liste2']; StartsWith(Title; TextSearchBox1.Text)); "Created"; If(SortDescending1; Ascending;Descending ))
;
    SortByColumns(Filter([@'Kantineformular Liste2']; Created_By_Email=User().Email ); "Created"; If(SortDescending1; Ascending;Descending ))

)

View solution in original post

5 REPLIES 5
NandiniBhagya20
Solution Sage
Solution Sage

Hi,

Can you please try wrapping Email id's in Lower function

Make sure you empty the default property of search text box 

SortByColumns(Filter([@'Kantineformular Liste2']; (Lower(Udfyldt_Af_Email)=Lower(User().Email) Or Lower(User().Email)=Lower("someuser@company.com")) && StartsWith(Title; TextSearchBox1.Text)); "Created"; If(SortDescending1; Ascending;Descending ))

 


Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

BCBuizer
Super User
Super User

Hi @DSKJ ,

 

I have made a slight modification to the syntax and added a condition where the TextSearchBox1 is blank:

 

SortByColumns(
	Filter(
		[@'Kantineformular Liste2'];
		Udfyldt_Af_Email=User().Email Or User().Email="someuser@company.com", 
		IsBlank(TextSearchBox1) Or StartsWith(Title; TextSearchBox1.Text)
	); 
	"Created"; 
	If(
		SortDescending1; 
		Ascending;
		Descending
	)
)

 



Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.
CamiloLuque
Advocate I
Advocate I

Hi @DSKJ, If your second user must see all records, why you use a filter for this user?. Before filter you can validate what user is and use a filter or not.

The formula with the extra email doesn't work because User().Email is not a column, you must use a column name to filter a table.

Thank you for that information - I didn't know it could be done that way. 

And also thank you for the information about the column issue

DSKJ
Frequent Visitor

Based on the help I got I now have it working. Maybe it's crude and could be optimized but it works and my dataset is very small 🙂

Here's an anonymized version to help other people:

If(User().Email="someuser@comecompany.com";
    SortByColumns(Filter([@'Kantineformular Liste2']; StartsWith(Title; TextSearchBox1.Text)); "Created"; If(SortDescending1; Ascending;Descending ))
;
    SortByColumns(Filter([@'Kantineformular Liste2']; Created_By_Email=User().Email ); "Created"; If(SortDescending1; Ascending;Descending ))

)

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,111)