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
PowerAddict
Super User
Super User

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
PowerAddict
Super User
Super User

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

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.

View solution in original post

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!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,213)