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

Adding a Second Field to Search

My app currently searches the "Title" field but I want it to also search the "ID" field. The function is listed below.

 

SortByColumns(Filter('New DXC SharePoint Pursuit Site Request Form', StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

 

How would I modify this to also allow searches for "ID"?

 

 

13 REPLIES 13

Thanks, @Drrickryp for the reply. When I tried your code, I got the following error: "Incompatible type. We can't evaluate your formula because the values being compared in the formula aren't the same type. The left value is a Text type and the right value is a Number type".

 

SortByColumns(Filter('New DXC SharePoint Pursuit Site Request Form', 'SFDC ID'=Value(Textsearchbox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

The error message "The left value is a Text type and the right value is a Number type" is puzzling since both fields from the SP list are single line text fields (i.e., both text data type). Any recommendations are greatly appreciated.

 

 

Change the formula removing the Value() function.  I'm surprised your ID is text and not a number.

SortByColumns(Filter('New DXC SharePoint Pursuit Site Request Form', 'SFDC ID'=Textsearchbox1.Text), "Title", If(SortDescending1, Descending, Ascending))

The 'SFDC ID' field is a text field, not a numeric field since it contains alphanumeric characters.  Unfortunately, when I tried the new code, all the items are missing like they've been filtered out.

I finally got it working. This code is attached to the gallery and uses a filter to look for either Title or SFDC ID. It also performs a default, ascending sort on Title. 

 

SortByColumns(Filter('New DXC SharePoint Pursuit Site Request Form', StartsWith(Title,TextSearchBox1.Text)||StartsWith('SFDC ID',TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

Thanks to everyone who responded as I could not have arrived at this solution with your help. 

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 (9,941)