cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gorilla_8
Impactful Individual
Impactful Individual

WORKING WITH FILTERS

I wanna filter a gallery based on a user().Email and if is not, show the only which he created. 

And I try this code:

 

If(User().Email="USER@ADMIN.COM";Despesas;Filter(Despesas;StartsWith(Solicitante;TextInput1.Text) || ID = DropDown1.Selected.ID || 'Status de pagamento'.Value=ComboBox4.Selected.Value;SortByColumns(Despesas;"ID";Descending);'Criado por'.Email = varUser.Email))


My goal is:

 

If is the USER@ADMIN.COM he can filter by name or ID or "status de pagamento", and if is not she only show the items he created. 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Gorilla_8 ,

 

I don't see any error in your syntax however try it as below:

Step1: 
If(User().Email="user@admin.com";Despesas;Filter(Despesas;CreatorEmail=varUser.Email)
Step 2:
If(User().Email="user@admin.com";Despesas;Filter(Despesas;CreatorEmail=varUser.Email||Solicitante = TextInput1.Text)
Step 3:
If(User().Email="user@admin.com";Despesas;Filter(Despesas;CreatorEmail=varUser.Email||Solicitante = TextInput1.Text||'Status de pagamento'.Value=DropDown1_1.Selected.Result)
step4:
If(User().Email="user@admin.com";Despesas;Filter(Despesas;CreatorEmail=varUser.Email||Solicitante = TextInput1.Text||'Status de pagamento'.Value=DropDown1_1.Selected.Result||ID=DropDown1.Selected.ID)

So we will know which is stopping the result set.


I hope this resolved your issue if you see any challenge/need further help please 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.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
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

20 REPLIES 20
KrishnaV
Super User
Super User

Hi @Gorilla_8 ,

 

Change your filter as below:

If(User().Email="USER@ADMIN.COM",
Sort(
Filter(Despesas,
StartsWith(Solicitante;TextInput1.Text) || ID = DropDown1.Selected.ID || 'Status de pagamento'.Value=ComboBox4.Selected.Value, 'Criado por'.Email = varUser.Email)),SortByColumns(Despesas,ID,Descending))

 

I hope this resolved your issue if you see any challenge/need further help 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.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
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.
Gorilla_8
Impactful Individual
Impactful Individual

Hi @KrishnaV , thanks again for the help!

 

But I got same error, he expects 2-3 parametres, I think I got lost some parentheses..

 

Take a look: 

 

If(User().Email="user@admin.com";
Sort(
Filter(Despesas;
StartsWith(Solicitante;TextInput1.Text) || ID = DropDown1.Selected.ID || 'Status de pagamento'.Value=ComboBox4.Selected.Value; 'Criado por'.Email = varUser.Email));SortByColumns(Despesas;ID;Descending))

Hi @Gorilla_8 ,

 

My bad I have correct my syntax errors, silly me 😞

If(User().Email="user@admin.com",
SortByColumns(
Filter(Despesas;
StartsWith(Solicitante;TextInput1.Text) || ID = DropDown1.Selected.ID || 'Status de pagamento'.Value=ComboBox4.Selected.Value; 'Criado por'.Email = varUser.Email);ID;Descending))

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.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
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.

Hi @Gorilla_8 ,

 

I just noticed that you like my reply is there anything I am missing to mark that as a solution?

 

Please let me know so that I can help you better.


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.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
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.
Gorilla_8
Impactful Individual
Impactful Individual

Hi @KrishnaV !, Igot this error: 

 

I dont know why, i dont worl well with multiple filters.

 

The 'sort columns' function has invalid arguments


 FILTERERROR.png

Hi @Gorilla_8 ,

 

Please change the Combobox selection as :

ComboBox2.Selected.Title
where my combobox is populating with SampleList.Title




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.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
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.
Gorilla_8
Impactful Individual
Impactful Individual

Hi @KrishnaV !


Didnt work out

Gorilla_8
Impactful Individual
Impactful Individual

Hi @KrishnaV !

 

I have make a filter by all the data, but can you help me to filter by selected user?

Filter(Despesas;CreatorEmail=varUser.Email||Solicitante = TextInput1.Text||'Status de pagamento'.Value=DropDown1_1.Selected.Result||ID=DropDown1.Selected.ID)

I have this code, but I wanna the user logged filter by only his created item. 

Hi @Gorilla_8 ,

 

Filter(Despesas;Creator.Email=varUser.Email||Solicitante = TextInput1.Text||'Status de pagamento'.Value=DropDown1_1.Selected.Result||ID=DropDown1.Selected.ID)// if creator is a people picker column

Filter(Despesas;Created.Email=varUser.Email||Solicitante = TextInput1.Text||'Status de pagamento'.Value=DropDown1_1.Selected.Result||ID=DropDown1.Selected.ID)// this will pull with the default created sharepoint list column


I hope this resolved your issue if you see any challenge/need further help please 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.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,951)