cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Garak0410
Level: Powered On

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
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

Garak0410
Level: Powered On

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...

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.

 

Garak0410
Level: Powered On

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

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'. 
Garak0410
Level: Powered On

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. 

 

 

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.

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.

Community Support Team
Community Support Team

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 331 members 6,301 guests
Please welcome our newest community members: