cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Improving Search

I recently starting dabbling in SharePoint Online and I made a simple Issue Tracker from the template and decided to create the PowerApps mobile app. Very easy to do and simple to deploy.

 

When users try searching for a customer, it comes up blank. It will only search the first, key column called Ticket Number and even then, it wasn't an exact search.

 

 

How do we improve the search function of a PowerApp? Primarally, it needs to be able to search part or all of a Customer Name. 

Thanks...

10 REPLIES 10
Highlighted
Super User
Super User

Re: Improving Search

Hi @Garak0410

 

If you select the gallery control that displays your results (by default, this is called BrowseGallery1), the 'items' property of this control specifies the search formula.

 

The Search function allows you to specify the columns that you want to search against. You can include your customer name column by adding it in the call to the Search function, as illustrated in this screenshot.

 

SearchCols.JPG

Highlighted
Helper I
Helper I

Re: Improving Search


@timl wrote:

Hi @Garak0410

 

If you select the gallery control that displays your results (by default, this is called BrowseGallery1), the 'items' property of this control specifies the search formula.

 

The Search function allows you to specify the columns that you want to search against. You can include your customer name column by adding it in the call to the Search function, as illustrated in this screenshot.

 

SearchCols.JPG


This is helpful...currently, it shows this:

 

SortByColumns(Filter('Issue Tracker', StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

So I need to modify this similar to the example you sent?

Thanks...

Highlighted
Super User
Super User

Re: Improving Search

Yes, that's correct. You would replace the formula with something that looks like this...

 

SortByColumns(Search('Issue Tracker', TextSearchBox1.Text, "Title", "CustomerName"), 
              "Title", 
              If(SortDescending1, Descending, Ascending)
)

Where I added "CustomerName", you would need to replace this with the actual name of your column.

 

Highlighted
Helper I
Helper I

Re: Improving Search


@timl wrote:

Yes, that's correct. You would replace the formula with something that looks like this...

 

SortByColumns(Search('Issue Tracker', TextSearchBox1.Text, "Title", "CustomerName"), 
              "Title", 
              If(SortDescending1, Descending, Ascending)
)

Where I added "CustomerName", you would need to replace this with the actual name of your column.

 


Oh we are closer...when I replaced the formula with the above code, I got multiple warnings:

 

power_apps_search01.jpgpower_apps_search02.jpg

Highlighted
Super User
Super User

Re: Improving Search

The first message is a delegation warning. This won't stop the search from working, but what it means is that if your source data contains more than a maximum of 2000 records, the results that PowerApps returns may not be accurate. If you search this forum, you'll find plenty of threads on this issue.

 

The cause of the second error message is most likely because "Customer" is a valid field name. If customer is a lookup column, we would need to modify the formula to account for this.  To confirm the correct field name, if you add a label to screen and type the following into the text property, does Intellisense bring up Customer as a valid field name?

'Issue Tracker'. 
Highlighted
Helper I
Helper I

Re: Improving Search


@timl wrote:

The first message is a delegation warning. This won't stop the search from working, but what it means is that if your source data contains more than a maximum of 2000 records, the results that PowerApps returns may not be accurate. If you search this forum, you'll find plenty of threads on this issue.

 

The cause of the second error message is most likely because "Customer" is a valid field name. If customer is a lookup column, we would need to modify the formula to account for this.  To confirm the correct field name, if you add a label to screen and type the following into the text property, does Intellisense bring up Customer as a valid field name?

'Issue Tracker'. 

I did the above and no, Customer is not coming up in Intellisense...I might have labeled it Customer but forgot where to go to view the original name. 

 

 

Highlighted
Super User
Super User

Re: Improving Search

Hi @Garak0410,

 

Hopefully, you'll resolve this problem when you find out the name of your customer field. Perhaps you could look at the Datafield property for the card in your edit screen to find out what this is.

Highlighted
Super User
Super User

Re: Improving Search

Hi @Garak0410 and @timl,

i found a good way to find out how SharePoint stores data is to put a datatable control on the screen and make the items property the data source. Then check the fields and see what’s in them. Also Search() is not delegatable in SharePoint lists. That’s why powerapps uses filter(Listname,StartsWith(... by default when it creates an app from data. My guess is that customers is a lookup field type in SharePoint. Like choice fields, These are actually embedded tables  in a single field and are more difficult to work with in Powerapps.

Highlighted
Community Support
Community Support

Re: Improving Search

Hi @Garak0410,

Which data type of the customer field within your SP list? Is it a Person type column?

I agree with @timl's thought almost. You could consider take a try to select the Customer Data card within the Edit form of Edit screen, then within right pop-up panel, click Advanced tab button, the original field name would be displayed within DataField property.

If the Customer column is a Person type column, you could consider modify your formula within the Items property of the Gallery as below:

SortByColumns(
Filter('Issue Tracker', StartsWith(Customer.DisplayName, TextSearchBox1.Text)),
"Title",
If(SortDescending1, Descending, Ascending)
)

In addition, above formula I provided may cause a Delegation warning, in order to get rid of the Delegation warning, please take a try with the following workaround:

Set the OnVisible property of the first screen of your app to following:

ClearCollect(IssueTrackerCollection,'Issue Tracker ')

Set the Items property of the Gallery control to following:

SortByColumns(
Filter(IssueTrackerCollection, StartsWith(Customer.DisplayName, TextSearchBox1.Text)),
"Title",
If(SortDescending1, Descending, Ascending)
)

 

Best regards,

Kris

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

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (4,567)