cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bolin-stratus
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
User Groups Public Preview

Join us for our User Group Public Preview!

Power Apps User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

Power Apps Community Call

Monthly Power Apps Community Call

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

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (29,460)