cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tonysommer
Helper II
Helper II

Not sure where to place search function

My current formula for my Gallery Items property is:

If(isAdmin,Sort(AllTickets,Created,Descending),Sort(Filter(AllTickets,Author.Email=MyProfile.Mail||Author.Claims=MyProfile.UserPrincipalName),Created,Descending))

 

I would like to add search functionality to filter all tickets:

 

Search(AllTickets, SearchBox.Text, "Title", "AssignedTo","Priority","TaskStatus")

 

However I am not sure where to put this at to allow both displaying all tickets and letting me search the gallery.

 

Any suggestions?

2 ACCEPTED SOLUTIONS

Accepted Solutions

Hi,

You have combined Sort and Filter correctly. You just need to replace AllTickets within your Filter by the search expression and also in the first sort function.

Something like this:

If(isAdmin,Sort(Search(AllTickets, SearchBox.Text, "Title", "AssignedTo","Priority","TaskStatus"),Created,Descending),Sort(Filter(Search(AllTickets, SearchBox.Text, "Title", "AssignedTo","Priority","TaskStatus"),Author.Email=MyProfile.Mail||Author.Claims=MyProfile.UserPrincipalName),Created,Descending))

Let me if this doesn't work.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit(Haman)

View solution in original post

Hi @PowerAddict ,

 

So far it is not possible to use the Search function for column types other than strings. 

 

There is a workaround which is using a collection created with your SharePoint list, then use the AddColumns function to run a calculation on the non-text field and turning it into a new field that was a text item. Then use Search on the newly created field.

 

AddColumns(myTable, "newColumn", PlainText(oldColumn.Value))

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7

Hi,

You have combined Sort and Filter correctly. You just need to replace AllTickets within your Filter by the search expression and also in the first sort function.

Something like this:

If(isAdmin,Sort(Search(AllTickets, SearchBox.Text, "Title", "AssignedTo","Priority","TaskStatus"),Created,Descending),Sort(Filter(Search(AllTickets, SearchBox.Text, "Title", "AssignedTo","Priority","TaskStatus"),Author.Email=MyProfile.Mail||Author.Claims=MyProfile.UserPrincipalName),Created,Descending))

Let me if this doesn't work.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit(Haman)

it is saying the Search function has some invalid arguments.

Apologies it does work. When it is the following:

If(isAdmin,Sort(Search(AllTickets, SearchBox.Text, "Title"),Created,Descending),Sort(Filter(Search(AllTickets, SearchBox.Text, "Title"),Author.Email=MyProfile.Mail||Author.Claims=MyProfile.UserPrincipalName),Created,Descending))

 

However whenever I add anything other than "Title" it states that there are some invalid arguments.

So you can only use text fields for searching. I believe Title is a text field. If you were trying to search by any other field that's not text, it will throw an error.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit(Haman)

No other way around this to search choice fields or drop-downs or anything?

Nothing that's available out of the box using Search function. However you can use filter function to get a list of the desired results. Will that work?

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit(Haman)

Hi @PowerAddict ,

 

So far it is not possible to use the Search function for column types other than strings. 

 

There is a workaround which is using a collection created with your SharePoint list, then use the AddColumns function to run a calculation on the non-text field and turning it into a new field that was a text item. Then use Search on the newly created field.

 

AddColumns(myTable, "newColumn", PlainText(oldColumn.Value))

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

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 (3,377)