Mastering Excel: Power Apps by Moore Mark

Mastering Excel: Power Apps by Moore Mark

Author:Moore, Mark [Moore, Mark]
Language: eng
Format: epub
Published: 2020-02-01T16:00:00+00:00


Showing ‘Text Input’ in the search box is counter intuitive. Instead, let’s use a hint text that tells users what is expected there. When the user types in the box, the hint text will disappear.

Select the Search box. Change the Default value to “”.

Change the hint text to Search Contacts

The search functionality behaves a little like the sort functionality. In sort, the sort button didn’t do the sorting but set a variable and let the BrowseGallery do the sort. For search, the search button doesn’t do anything but store the input. Once again, the BrowseGallery does all the work.

The search function searches through 1 or more columns for the indicated text and returns all records that match. Search is case insensitive.

Search does not return a value, search returns a table that can have 1 or more records. PowerApps considers tables as values, like a text or number, and tables can be passed from function to function. This is important to understand .

Search, in itself, doesn’t change a table. Search accepts a table as a parameter and returns another smaller table.

Remember the SortByColumns function? That function accepts a table to sort as its first parameter. You are going to use the Search function inside the SortByColumn function.

Once again, it’s harder to explain than it is to do.

The search function has the following syntax:

Search([Table], [Search String], [Column1], [Column2], ...)

Table: Table to search

Search String: text to search for

Column: All the columns to search through for a match

Change the Items formula from this:

SortByColumns(ContactList,"Last_x0020_Name",If(SortDescending1,Ascending,Descending))

to this:

SortByColumns(Search(ContactList,[@Search].Text,"Department","Email","First_x0020_Name") ,"Last_x0020_Name",If(SortDescending1,Ascending,Descending))

In essence, replace ContactList with Search(ContactList,[@Search].Text,"Department","Email","First_x0020_Name")

What is @Search?

Naming matters in PowerApps. You named the search box ‘Search’, but now you want to use the ‘Search’ function. How does PowerApps know if you mean the function or the object?

You need to use the @ sign. @ is called the disambiguation operator. As you type in Search in the formula bar, PowerApps will list all the available options it finds.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.