cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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

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.

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

20 REPLIES 20
Super User III
Super User III

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.

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.

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.

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.

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.

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.

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.

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.

Hi @KrishnaV !


Didnt work out

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.

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
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (27,147)