cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Searching Multiple Fields

I have a PowerApp created from a SPO List. I would like to search the entries using multiple fields. Currently it only searches in one field. The formula in the search bar is:

SortByColumns(Filter([@'List Name'], StartsWith(Field1, TextSearchBox1.Text)), "Field1", If(SortDescending1, Descending, Ascending))

 

I tried changing the formula to

SortByColumns(Search([@ListName], TextSearchBox1.Text, "Field1","Field2", "Field3"), "Field1", If(SortDescending1, Descending, Ascending))

 

The new formula causes a bunch of errors and all the entries disappear from the PowerApps. What am I doing wrong or what can I do to fix the issue?

 

Thank You!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Hi @nurulain 

You can change it to something like this:

SortByColumns(
	Filter([@'List Name'], 
	StartsWith(Field1, TextSearchBox1.Text)) ||
	StartsWith(Field2, TextSearchBox1.Text)) ||
	StartsWith(Field3, TextSearchBox1.Text)) ||
	StartsWith(Field4, TextSearchBox1.Text)), 
	"Field1", 
	If(SortDescending1, Descending, Ascending)
)

the || is equal to OR. Meaning, it will search either of those fields.

 

I hope this helps.


Please click Accept as Solution if my post answered your question. Like my answer? Consider giving it a Thumbs Up. Others seeking the same answers will be happy you did.

Please click Accept as Solution if my post answered your question. Like my answer? Consider giving it a Thumbs Up. Others seeking the same answers will be happy you did.

View solution in original post

1 REPLY 1
Super User
Super User

Hi @nurulain 

You can change it to something like this:

SortByColumns(
	Filter([@'List Name'], 
	StartsWith(Field1, TextSearchBox1.Text)) ||
	StartsWith(Field2, TextSearchBox1.Text)) ||
	StartsWith(Field3, TextSearchBox1.Text)) ||
	StartsWith(Field4, TextSearchBox1.Text)), 
	"Field1", 
	If(SortDescending1, Descending, Ascending)
)

the || is equal to OR. Meaning, it will search either of those fields.

 

I hope this helps.


Please click Accept as Solution if my post answered your question. Like my answer? Consider giving it a Thumbs Up. Others seeking the same answers will be happy you did.

Please click Accept as Solution if my post answered your question. Like my answer? Consider giving it a Thumbs Up. Others seeking the same answers will be happy you did.

View solution in original post

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,691)