cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Prodigy
Post Prodigy

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
Highlighted
Community Champion
Community Champion

Re: WORKING WITH FILTERS

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.

View solution in original post

20 REPLIES 20
Highlighted
Community Champion
Community Champion

Re: WORKING WITH FILTERS

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.

Highlighted
Post Prodigy
Post Prodigy

Re: WORKING WITH FILTERS

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))
Highlighted
Community Champion
Community Champion

Re: WORKING WITH FILTERS

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))
Highlighted
Community Champion
Community Champion

Re: WORKING WITH FILTERS

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.

Highlighted
Post Prodigy
Post Prodigy

Re: WORKING WITH FILTERS

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

Highlighted
Community Champion
Community Champion

Re: WORKING WITH FILTERS

Hi @Gorilla_8 ,

 

Please change the Combobox selection as :

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



Highlighted
Post Prodigy
Post Prodigy

Re: WORKING WITH FILTERS

Hi @KrishnaV !


Didnt work out

Highlighted
Post Prodigy
Post Prodigy

Re: WORKING WITH FILTERS

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. 

Highlighted
Community Champion
Community Champion

Re: WORKING WITH FILTERS

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.

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

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

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!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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