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

Search Item problems

Hi, I have created an app for our mobile phones. I do have a couple of issues with it. the first one I need to get working is the 'Search' box. If I type in a name for example the window just goes blank. It is clearly missing something, possibly a formula, but being relatively new to this, it is proving to be a mind boggler. I have attached some pics below with what I have on screen both from my laptop and the mobile app itself.

PA JMS pic 1.jpgSearch Bar showing AdvancedPA JMS pic 2.jpgSearchIcon1 showing advancedPA JMS pic 3.jpgshowing auditor name and initiatorPA JMS pic 4.jpgshowing blank when a name entered in search box

2 ACCEPTED SOLUTIONS

Accepted Solutions
DebsWadge
Level: Powered On

Re: Search Item problems

Hi

 

In the BrowseGallery1, in advanced there is a formula as follows:

 

SortByColumns(Filter('JMS Audit Register', StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

 

The formula in there was generated by PowerApps when I created the app.

It's all a bit confusing to me, to be honest.  The app is not showing an error, however, it is saying there is an issue,

'Invalid argument type (Record). Expecting a Text value instead'. In the formula the word "Title" is in red. I am not sure if that is where the problem lies. The rest of the formula is in blue, green, black and plum as shown above.

 

View solution in original post

Luke_Timmins
Level 8

Re: Search Item problems

Hi DebsWadge

I would recommend reading the ms documentation on PowerApp functions.

The function you want to use is search.

SortByColumns(Search('JMS Audit Register',SearchBox1.Text,"COLUMNNAMHERE"),"Auditor", If(SortDescending1, Descending, Ascending))

You can also search more than one column if needed by adding additional parameters to the search function I.e.

SortByColumns(Search('JMS Audit Register',SearchBox1.Text,"COLUMNNAMHERE","COLUMNNAMEHERE"),"Auditor", If(SortDescending1, Descending, Ascending))

Hope this helps.
Luke

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup

View solution in original post

8 REPLIES 8
lucia
Level 8

Re: Search Item problems

Hey,

 

if you want to use your search box you have to write formula for the gallery, for items field on the gallery control, that it should be filtered by the search box.

 

E.i. : Search(Datasource, TextSearchBox1_1.Text ,field_on_datasource) or Filter(datasource, TextSearchBox1_1.Text in field_on_datasource)

 

Note: field_on_datasource is the field in which should be the value in searchbox searched.

 

Hope this helps.

PavanKumar
Level 8

Re: Search Item problems

Hi,

 

You can do the following to resolve the issue.

 

1. Bind a collection to the gallery (e.g colAuditRegistry)

2. Onvisible of the screen use the formulae to get values for collection and collect it in a collection.

ClearCollect(colAuditRegistry,Datasource)

Note: If you want to show particular data from the datasource you can filter that here as well.

3. onSelect of Search Icon write another formulae which searches with the textbox value.

ClearCollect(colAuditRegistry, Search(Datasource, TextSearchBox1_1.Text ,field_on_datasource) );

Note: Replace the textbox field name and fieldondatasource with which field you want to search.

 

 

Feel free to let me know if you have any further questions.

 

If this answers your question mark it as verified and give thumbs up

Regards,

Pavan Kumar Garlapati

DebsWadge
Level: Powered On

Re: Search Item problems

Hi

 

In the BrowseGallery1, in advanced there is a formula as follows:

 

SortByColumns(Filter('JMS Audit Register', StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

 

The formula in there was generated by PowerApps when I created the app.

It's all a bit confusing to me, to be honest.  The app is not showing an error, however, it is saying there is an issue,

'Invalid argument type (Record). Expecting a Text value instead'. In the formula the word "Title" is in red. I am not sure if that is where the problem lies. The rest of the formula is in blue, green, black and plum as shown above.

 

View solution in original post

PavanKumar
Level 8

Re: Search Item problems

Hi,

 

Don't worry about Red color Title, its just to show which column are you using in the list to search.

 

Use the same formulae onselect of search icon and see when you search for a record and click on search icon its returning the values in gallery.

 

If this answers your question mark it as verified and give a thumbsup

Regards,

Pavan Kumar Garlapati

Community Support Team
Community Support Team

Re: Search Item problems

Hi @DebsWadge ,

Is the "Wadge" search word existed in the Title column in your SP List?

Does the SearchBox in your app work within your browser? Or same issue as that in your mobile device?

 

Based on the formula and screenshot that you provided, I could not find any syntax issue with it. If the "Wadge" search word is not existed within the Title column of your SP List, please consider modify your formula as below:

 

SortByColumns(
Filter('JMS Audit Register', StartsWith(Title, TextSearchBox1.Text)),
"Title", If(SortDescending1, Descending, Ascending),
"SearchColumn", If(SortDescending1, Descending, Ascending)
)

Note: The SearchColumn represents the Text column in your SP list, which used to store the "Wadge" search word.

 

Also please consider turn off the "Improved app rendering (final validation)" option wtihin Advanced settings of App settings of your app, then re-publish your app, run your app in mobile device again, check if the issue is solved.

 

Best regards,

 

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

Re: Search Item problems

I think I have more or less solved the problem I was having. by changing the format of the field, so it now works to search and sort. I still have 1 little problem with the search. the search is based on the Auditor field. At the moment there are only 2 people who have entered into it as it is still a job in process. If I want to search on say Paul Jones for example. If I start typing in P it will put names up beginning with P, in this case there is only 1 entry. However, if for example, I type in 'ul' the page goes blank. It should pick up any of the names in that field that have whatever letters I type in. I would only expect a blank page if it couldn't find any. e.g. If I typed in a 'Y' then it would be blank as there are no names with a 'Y' in it. I've watched various UTube videos and have followed them, however, I can't seem to get around this 1 little problem. It is most likely, something really tiny, but I can't figure it out. the formula is below and I have attached 2 pics to show what I mean.

SortByColumns(Filter('JMS Audit Register', StartsWith(Auditor, SearchBox1.Text)),"Auditor", If(SortDescending1, Descending, Ascending))

Luke_Timmins
Level 8

Re: Search Item problems

Hi DebsWadge

I would recommend reading the ms documentation on PowerApp functions.

The function you want to use is search.

SortByColumns(Search('JMS Audit Register',SearchBox1.Text,"COLUMNNAMHERE"),"Auditor", If(SortDescending1, Descending, Ascending))

You can also search more than one column if needed by adding additional parameters to the search function I.e.

SortByColumns(Search('JMS Audit Register',SearchBox1.Text,"COLUMNNAMHERE","COLUMNNAMEHERE"),"Auditor", If(SortDescending1, Descending, Ascending))

Hope this helps.
Luke

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup

View solution in original post

Highlighted
DebsWadge
Level: Powered On

Re: Search Item problems

Hi Luke, That is perfect. I can see now where the problem was and it was something small but made a real irritating problem. Thank you all for your help and advice, it is very much appreciated.

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: 468 members 6,195 guests
Please welcome our newest community members: