Wednesday 20 December 2023

Power Apps Currency Format - Canvas App currency comma separated like excel - CanvasApp Formulas

 

Power Apps Currency Format


Do you know how to format a number to currency in Power Apps? No issues!

This Power Apps tutorial will help you learn how to use the Power Apps currency format, its syntax, and features.

Also, we will see how to format numbers as currency in Power Apps and many more like:

  • Format number decimal places in Power Apps
  • Power Apps currency format with commas
  • How to format currency Euro in Power App





  • Power Apps Currency Format

The method by which numerical numbers are shown to represent monetary quantities in Power Apps is referred to as the currency format. The proper currency sign, decimal places, and maybe separators for thousands are usually included in this format.

The table below represents different aspects of currency formatting in Power Apps:

FeatureDescriptionExample
Currency SymbolIncorporates the currency symbol into the display of monetary values.$, €, £
Decimal PlacesSets the number of decimal places, typically two for currency.1234.56 → $1,234.56
Thousand SeparatorUses commas or other separators for easier readability of large numbers.1000000 → $1,000,000
Locale-Based FormattingFormats currency according to the user’s regional settings, affecting symbol placement, decimal, and thousands of separators.US: $1,234.56, France: 1 234,56 €
Custom FormattingEnsures proper data types like numbers or decimals for accurate currency representation and calculations.$#,###.00 → $1,234.56
Data TypesEnsures proper data types like numbers or decimals for accurate currency representation and calculations.Number, Decimal
Formatting FunctionsUtilizes functions like Text formatting numbers as currency. The format can be specified in the function.Text(1234.56, "$#,###.00")
ConsistencyMaintains uniform currency formatting across the app for clarity and professionalism.All currency displayed as $#,###.00

Syntax:

Below is the syntax of the Power Apps currency format:

Text(35653, “$#,##0.00”)

Power Apps converts 35653 [number] into a structured text string representing a currency value.

Where,

  • Text = Power Apps Text function is used to convert a value to a formatted text string
  • 35653 = Specify the number you want to format as currency

Let’s discuss a simple scenario.

Example:

1. The image below represents a Text input and Label control. Any number the user enters in the text box will be converted to currency format.

Power Apps Currency Format

2. To work with this, select the label control and set its Text property to the code below:

Text = Text(
    Value(txtNumber.Text),
    "[$-en-US],$#,###.00"
)

txtNumber = Text input control name where the user will enter the number

powerapps currency format

3. Save, publish, and preview the app. Enter any number in the text box. The number’s value will be converted to currency and displayed in the label control.

This is how to work with Power Apps currency format.

Power Apps Format Number As Currency

Here, we will discuss how to format a number as a currency in Power Apps.

The screenshot below represents a Power Apps Gallery control and an Edit form. When a user selects any particular item from the gallery, the field values will display in the edit form.

But the Currency field [Course Fee] will appear as a number value instead of a currency value. After converting the number as a currency, the field will look like the image below.

powerapps format number as currency

To achieve this, follow the instructions below:

1. I have a SharePoint list named Course Evaluation Details. This list has these many fields below:

ColumnDatatype
TitleSingle line of text
Course DescriptionMultiline of text
Single InstructorPerson
Course FeeCurrency

Refer to the figure below.

Power Apps Format Number As Currency

2. Next, in Power Apps, insert a Gallery control [+ Insert -> Vertical gallery] and set its Items property as:

Items = 'Course Evaluation Details'
powerapps format currency

3. Add an Edit form [+ Insert -> Edit form] and set its DataSource property to the SharePoint list:

DataSource = 'Course Evaluation Details'
powerapps format as currency

4. On the Edit form’s Item property, write the formula below:

Item = galCourseDetails.Selected

Where,

galCourseDetails = Gallery control name

power apps format currency

5. To convert the Number field to currency, select the field [Course Fee] from the edit form and apply the Default property as:

Default = "$" & Text(
    Parent.Default,
    "[$-en-US]0.00"
)

Power Apps will automatically prefix your format with “[$-en-US]” when you enter “0.00“.

NOTE:

Use the following formula on the Text property of the Text input control or Label control in place of any Data card value:
Text = “$” & Text(ThisItem.’Your Currency Field Name’, “[$-en-US]0.00”)
currency format powerapps

6. Save, publish, and preview the app. Select any item from the gallery, then the item details will appear in the edit form, and the Course Fee field will display with the currency format.

This is how to format numbers as currency in Power Apps.

Power Apps Format Number Decimal Places

In Power Apps, I’ll demonstrate how to format decimal numbers. The Typical Software Costs column in the SharePoint List picture below includes several currency records.

I want to format every number in decimal places right now. In other words, if the value in the first record is “$10,560.59“, I want to change it to “$10,560.6“.

Powerapps format Number Decimal Places

Follow the below steps to format Number Decimal Places.

1. The screenshot below represents a Power Apps Gallery Control. This gallery screen has only the Title and Subtitle fields. The Subtitle field has the Currency field (Typical Software Costs).

I want to make this currency field like Decimal Places (10560.6).

Power apps format Number Decimal Places

2. Select the Subtitle label field and apply the below formula on its Text property as:

Text = Text(ThisItem.'Typical Software Costs', "#.#")

In the formula, When you put “#.#“, PowerApps will automatically add the “[$-en-US]” prefix to your format to tell the system what locale format to use. Then the formula looks like as below:

Text = Text(ThisItem.'Typical Software Costs', "[$-en-US]#.#")

Where,

Typical Software Costs = Currency Field Name

powerapps format number decimal place

3. Save, publish, and preview the app. You can view all the Currency values in the Decimal Format in the gallery.

This is how to format number decimal places in Power Apps.

Power Apps Currency Format With Commas

Here, we will work with Power Apps Currency Format With Commas.

A Power Apps Gallery control displays the currency value from the SharePoint list. To work with this, select the gallery and set its Text property as:

Text = Text(
    ThisItem.'Course Fee',
    "[$-en-US]$ #.00"
)

Course Fee = SharePoint Currency Column

Power Apps Currency Format With Commas

This is how to work with Power Apps currency format with commas.

Power Apps Format Currency Euro

Here, we will see how to format the currency value to Euro value in Power Apps.

You can see there is a Text input control and a Label control. Any number the user enters in the text field will be converted to euros and shown in the label below.

Power Apps Format Currency Euro

1. To do so, select the label control and set its Text property to the formula below:

Text = Text(
    Value(txtNumber.Text),
    "[$-en-US],€###,###.00"
)

Where,

txtNumber = Text input control name

powerapps format currency euro

2. Save, publish, and preview the app. Enter any number in the text box. The number’s value will be converted to Euro currency and displayed in the label control.

This is how to work with Power Apps Format Currency Euro.

Conclusion

This Power Apps tutorial taught us how to use the Power Apps currency format, its syntax, and features.

Also, we saw how to format numbers as currency in Power Apps and many more like:

  • How to format number decimal places in Power Apps
  • Working with Power Apps currency format with commas
  • Format currency Euro in Power Apps

Wednesday 13 December 2023

PowerApps Search Function + How to use with example + delegation + listbox + filter and collections + Reset searchbox + Combo box

 

PowerApps Search Function + How to use with example


In this Power Apps Tutorial, We will discuss what is the PowerApps Search function, it’s syntax, how to use the Power Apps search function in a canvas app. We will see how to apply a search box in PowerApps.

We will also see how to search for items from the SharePoint list using the PowerApps search function.

Also, We will see how to use the Search function in a Vertical Gallery Control and how can you do multiple searches.

Also, We will discuss what is the PowerApps Search Delegation and how to use the Search function in a Drop-down control in Power Apps.



Power Apps Search Function

We can use the PowerApps search function to find records from a table that contains a string value in any of the columns. The search string can be presented anywhere in the columns.

PowerApps search function returns the same columns which are presented in the table from where you searching.

The table should contain columns which are having a Text or String value. Apart from a Text value, it will not take any other column value like Number, Choice, Picture, Hyperlink, etc.

Also, a Lookup column does not work with the Power Apps Search function at all.

The Search function uses a single string to match instead of a formula. That’s why this Powerapps Search function is case-insensitive in nature.

PowerApps search function syntax

Below represents the Power Apps Search Function Syntax:

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

Where,

  • Search = It is the Power Apps function which helps to search.
  • Table = Specify the Table name that is used to search.
  • SearchString = Specify the string to search for. It will be returned to all the records if there will be a blank or an empty string.
  • Column(s) = Specify the column names those you want to search from the table. Whatever you are passing the columns, it should be a Text column and the column names should be strings which is in double-quotes. The specified column name should be static and cannot be calculated with a formula.

Use PowerApps Search Function in a Vertical Gallery Control

We can use the Search function in a Vertical Gallery control, follow the below steps:

If you are new to PowerApps, then check out few article on Create a canvas app from Excel in Power Apps (Step by Step tutorial) and also you can check How to Create a Canvas app from SharePoint List in Power Apps.

Step-1:

First of all, On your PowerApps Screen, Add a Blank Vertical Gallery Control (Insert -> Gallery -> Vertical). Then connect a Data Source as SharePoint (As my records are present in a SharePoint List) as shown below.

powerapps search function sharepoint list
Power Apps SharePoint data source

Step-2:

Select or Enter your SharePoint site or URL and Connect it. Then choose your SharePoint List (Event Registration Details) and hit on the Connect button.

NOTE:

Not only you can use the Data source like SharePoint, But also, you can use the Data source as Excel (Import from Excel).
PowerApps Search Function
SharePoint data source in PowerApps

Step-3:

In the below screenshot, you can see all the records are retrieved from the SharePoint List. Here, your Item property should be your SharePoint List name (‘Event Registration Details‘).

Select the Gallery and go to the Properties pane. Select the Layout as “Title, subtitle, and body“. Edit the fields and add the columns as per your choice.

powerapps search function gallery
PowerApps Gallery Control

Step-4:

Now to search the fields from the PowerApps vertical gallery, we need to add a search bar on the top of the Gallery. For that, Go to Insert -> Text -> Add Text Input as shown below.

The Text input control will insert and it will show the default value as Text. Just remove the Default value.

Search Function in PowerApps
PowerApps Text input control

Instead of the Default value, We will add a HintText value as “Search on Name”. instead of Name, you can provide anything like “Search on Profile”, “Search on Department”, “Search on Organization” etc.

The benefit of adding the HintText in the text control is, it will look like a Search box and more attractive.

powerapps search function multiple conditions
PowerApps search function hinttext

Step-5:

Add a Search icon (Insert -> Icons ->Search) near to the Search box. So that it will look like a perfect Search box to find out any fields like the below screenshot.

The OnSelect Property of the Search icon should be false.

powerapps search function syntax
PowerApps search icon

Step-6:

Select the Vertical Gallery control and apply the below Search function formula on its Items property as:

Items = Search('Event Registration Details', SearchBox.Text, "Title")

Where,

  • Search = This is the function used to find out the record from a table.
  • Event Registration Details‘ = This is the SharePoint List name.
  • SearchBox.Text = This is the Text input control name that I have added for searching.
  • Title” = It is the SharePoint List column name which is used to search in the search box.
powerapps search function example
PowerApps search function example

Step-7:

Just Preview (F5) or run the app. Search by Title or Name in the Search bar, then you can see it will search by the particular name and give you the appropriate result as shown below.

power apps search function sharepoint list
Search in PowerApps


PowerApps search function multiple conditions

Suppose, you want to do multiple conditions searches using the Search function in PowerApps. That means, if you want to search by Name, also you want to search by Organization or by Email Address, then you can do it.

But, all the fields should contain only the String or Text value otherwise it will not allow us to search and an error will appear on the screen.

In this case, you can apply the below formula on the Gallery Items property as:

Items = Search('Event Registration Details', SearchBox.Text, "Title", "Organization", "EmailAddress")

Where,

“Title”, “Organization”, “EmailAddress” = These are the SharePoint list fields that contains only the Text value.

powerapps search function sharepoint list
PowerApps search function multiple conditions

Once you will preview and search by name, by Organization or by Email Address, then it will give you the perfect result as like the below screenshot.

powerapps search function using sharepoint list

NOTE:

Some times, you may get the Search function invalid argument error while using the Search function with multiple conditions in Power Apps. You can overcome this type of issue by using the below Power Apps article:
The function Search has some invalid arguments in PowerApps

Search Delegations in PowerApps

You can see, there will be a warning suggestion is visible on the top of the gallery. This is known as the Delegation suggestion.

You will get this Search Delegation suggestion when your data in the data source exceeds 500 records and a function can’t be delegated. In this case, the Power Apps may not able to get your data and may give the wrong results.

You can use any Data source and formula if you are working with the small data sets which are fewer than 500 data or records.

Solution:

To get over from this Delegation problem, We need to change the Value from the Power Apps Advanced settings.

This can be easily changed by using the File tab -> Settings -> Advanced settings -> Value -> make the Value as 500 to 2000 as shown in the below screenshot.

Search function Power apps
Search Delegations in Power Apps

The value will take in between 1 to 2000 only. Once it exceeds 2000, then it won’t take.

Also, you can do another thing. If your data in the Data set is having more than 500 value, then you need to break the data from data sets in an equal manner. After that, make individual data set and each data set value should be 500.

PowerApps Search using a Drop-Down Input Control

You can use the PowerApps Search function using a Drop-down control. On your Power Apps screen, Add a Dropdown control (Insert -> Input -> Dropdown) as shown below.

powerapps searchable dropdown
PowerApps drop down control

Select the Drop-down input control and apply the below formula on it’s Items property as:

Items = Search('Event Registration Details', SearchBox.Text, "Title", "Organization", "EmailAddress")
power apps searchable dropdown
powerapps search dropdown

When you will preview the app, then you cannot able to see anything in the drop-down control as shown below.

The reason behind this thing because the above Search formula is returning all the columns from the SharePoint List (Event Registration Details).

To show a particular column value, We need to use the ShowColumn function.

power apps searchable drop down
powerapps search dropdown list

Apply the below formula on the Drop-down Items Property as:

Items = ShowColumns(Search('Event Registration Details', SearchBox.Text, "Title", "Organization", "EmailAddress"),"Title")

Not only you can use the Show Column value as “Title”, But also, you can use any other Text or String column like “Organization”, “EmailAddress”, etc.

powerapps searchable drop down
powerapps dropdown search field

Now preview or run the app and click on the drop-down. You can see all the Titles or Names as below screenshot.

searchable dropdown powerapps
powerapps search dropdown list

Similarly, When you will search the name on the Search box, it will reflect in the Dropdown bar. Suppose, you are searching a name by “Sania”, then the name “Sania” is reflecting in the Dropdown bar as shown below.

searchable dropdown power apps
powerapps search dropdown list

Next, we will see what does the mean of PowerApps search and filter combined.

  • Filter with Search together in PowerApps is known as PowerApps search and filter combined. That means, to get a result, we can search and as well as filter the gallery.
  • In the below screenshot, you can see there is a text input control and a gallery control. Here I need to put search so that users can find specific numbers while app is retrieving certain fields through a Sharepoint List or a Table.
  • when I am searching the Employee ID in the text box, then the gallery is filtering and displaying the result. And even if I am not seraching anything in the text box, then also the gallery is filtering and appearing with the same result.
  • So this is the thing, at a time you can search and as well as filter the gallery to display the result. Follow the below code to do this.
PowerApps search and filter combined
PowerApps search and filter combined
  • Select the gallery and apply the below formula on its Items property as:
Items = Search(
    AddColumns(
        Filter(
            'Employee Onboarding',
            'Employee ID' = 102
        ),
        "Result",
        Text('Employee ID')
    ),
    txtEnterID.Text,
    "Result"
)

Where,

  1. AddColumns = PowerApps AddColumns is a type of function that helps to add a column to a SharePoint list or a table. To know more details about this function, please refer to this complete tutorial: PowerApps AddColumns Function with Examples
  2. Employee Onboarding‘ = Specify the SharePoint list name
  3. Employee ID‘ = SharePoint Number field name
  4. Result” = Specify the new column name
  5. txtEnterID = Text input control name
Power Apps search and filter combined
Power Apps search and filter combined

NOTE:

You need to ensure to set the “Data row limit” option to maximum value — 2000 within General settings of App settings of your app.

This is how to work with PowerApps search and filter combined.

Read: Power Apps Search SharePoint List Examples

Do you need to create a PowerApps search button that will display only the Yes value while a user clicks on it? It’s very simple to create a button and display the values in PowerApps.

  • The below image represents a Button control and a gallery control. If you will click on the button (Click to show Approve items), then the gallery will display all the records those are approved. And again when you will tap on the button, then the gallery will revert back to the previous records.
PowerApps search button
PowerApps search button
  • So this is my SharePoint list that I have used in the app named Products. And these are the below items that are used in the gallery control. Now I would like to view all the approved items in the gallery on the button click.
search button in Power Apps
  • To do this, we need to create a context variable on the OnSelect property of the button control:
OnSelect = UpdateContext({Filtered: Not(Filtered)})

Where,

Filtered = Context variable name

Power Apps search button
  • Next, apply the below formula on the gallery’s Items property as:
Items = If(
    Filtered,
    Filter(
        Products,
        Status.Value = "Approved"
    ),
    Products
)

Where,

  1. Filtered = Context variable name
  2. Products = SharePoint list name
  3. Status = This is a Sharepoint choice column. So we need to mention this field name with a .Value
  4. Approved” = Provide the choice value that you want to filter in the gallery

Refer to the below screenshot.

search button in PowerApps
search button in PowerApps

That’s what it does in the app. Now you can perform it as per your choice.

  • Suppose if you want the operation to be “one way” (i.e. once you apply the filter it sticks forever), then you need to change the formula on the button’s OnSelect property:
OnSelect = UpdateContext( { Filtered: true } )

This is the search button in PowerApps.

Also, read: PowerApps Search User

In this topic, we will see how we can search the Data table control in PowerApps.

The below scenario explains how you can search and filter the data table control based upon a Dropdown menu in PowerApps.

  • I have a SharePoint list named TSInfo Attachments. This list has some below columns:
  1. ID = By default it is a Number type column in the SharePoint list
  2. Title = This is also a by default column in the list
  3. Attachment Types = This is the name of SharePoint Choice column
  4. Book Author = People picker column name
  5. IsReceived = Yes/No field
  6. IsSatisfied = Yes/No field
how to search data table in PowerApps
how to search data table in PowerApps
  • Now in the app, there is a Dropdown control and a Data table control. The dropdown menu has the choice values those are retrieved from the SharePoint choice column (Attachment Types).
  • When a user will select any choice value from the dropdown control, then the data table will filter and display only those specific searchable records.
  • For example, as I selected the Document type as PDF, so the data table displayed all the records those are related to PDF only as shown below.
PowerApps search data table
PowerApps search data table
  • To do so, select the dropdown menu and set its Items property as:
Items = Choices('TSInfo Attachments'.'Attachment Types')
Power Apps search data table
Power Apps search data table
  • Next, apply the below code on the Data table’s Items property as:
Items = Filter(
    'TSInfo Attachments',
    ddSelectDoc.SelectedText.Value in 'Attachment Types'.Value
)

Where,

  1. ddSelectDoc =Dropdown control name
  2. Attachment Types’.Value = As this is a SharePoint choice field, so we need to specify this field with a .Value parameter

Refer to the below screenshot.

Search data table in PowerAppsSearch data table in PowerApps
Search data table in PowerApps

This is how to work with the PowerApps search data table.

Also read: PowerApps SharePoint Lookup Column + PowerApps Dropdown Example

Do you want to show only if the search is an exact match in PowerApps? Yes, you can do it very easily. Check out this link to get more details: PowerApps search exact match

Do you know what is PowerApps highlights search text and how you can achieve it? Here we will see how to highlight search terms in the search result in PowerApps.

  • Refer to the below screenshot. you can see there is a Text input control and a gallery control. In the first image, when a user searched the Book Name as Power, then in the gallery, nothing happened.
  • In the second image, when a user searched the Book Name as Power, then the specific searching word got highlighted in the gallery control. This is known as highlight search text in PowerApps.
  • So whatever the word a user will search in the search box, that specific word will get highlight in the gallery control as shown below.
PowerApps highlight search text
PowerApps highlight search text
  • To make this possible, we will use the HTML text control inside the gallery. Because this highlight thing you can achieve in the HTML text control only.
  • Here, the Items property of the gallery contains the below code:
Items = Search(
    'TSInfo Attachments',
    txtSearchBook.Text,
    "Title"
)

Where,

  1. TSInfo Attachments‘ = SharePoint list name
  2. txtSearchBook = Text input control name where a user will search the book name
  3. Title” = SharePoint text column
Highlight search text in Power Apps
Highlight search text in Power Apps
  • To achieve this need, select the main section of the gallery and replace a HTML text instead of the label control.
Highlight search text in PowerApps
Highlight search text in PowerApps
  • To replace it, go to Insert tab -> Text -> HTML text and then the HTML control will add in that gallery section as like the below screenshot.
Power Apps Highlight search text
Power Apps Highlight search text
  • Next, select the HTML text control and apply the below code on its HtmlText property as:
HtmlText = "Book Name: " & Substitute(
    ThisItem.Title,
    txtSearchBook.Text,
    "<font color=Lightgreen>" & txtSearchBook.Text & "</font>"
)

Where,

  1. Book Name: ” = This is the text that will display in the HTML text control
  2. Substitute = PowerApps Substitute function helps to identify the string to replace by matching a string. To read more details, refer to this complete tutorial: PowerApps Replace Function with examples
  3. Title = SharePoint Text field
  4. txtSearchBook = Text input control name
Highlight search text Power Apps
Highlight search text Power Apps

This is how to work with highlight search text in PowerApps.

Do you want to search and filter the records by an Integer in PowerApps? Follow the below scenario to get some ideas that how you can use it.

  • The below screenshot represents, when you do not search anything in the search box, then the gallery will appear with all the SharePoint records. When a user will search any employee ID, then the gallery will filter and display that specifc searchable record details as shown below.
PowerApps Search Integer
PowerApps Search Integer
  • The below screen represents the Sharepoint List named Employee Onboarding. This list has some different types of columns like single line of text, Number, Choice, etc.
  • There is an Employee ID field with the Number data type. In PowerApps, I would like to search and filter the gallery based upon this Employee ID column.
Search Integer PowerApps
Search Integer PowerApps
  • To workwround with this, select the gallery control and set the below code on its Items property as:
Items = Filter(
    'Employee Onboarding',
    Or(
        StartsWith(
            Title,
            txtEnterEmpID.Text
        ),
        StartsWith(
            'Employee ID',
            Value(txtEnterEmpID.Text)
        )
    ),
    "Date"
)

Or, you can apply the below formula:

Items = Filter(
    'Employee Onboarding',
    Or(
        StartsWith(
            Title,
            txtEnterEmpID.Text
        ),
        StartsWith(
            Text('Employee ID'),
            txtEnterEmpID.Text
        )
    ),
    "Date"
)

Where,

  1. Employee Onboarding‘ = SharePoint List name
  2. StartsWith = PowerApps StartsWith function helps to test whether a text string begins with another. To read more details about this function, refer to this complete post: PowerApps StartsWith and EndsWith Functions
  3. Title = SharePoint single line of text field
  4. txtEnterEmpID = Text input control name where the user will search any employee ID
  5. Employee ID‘ = SharePoint Number field
Power Apps Search Integer
Power Apps Search Integer

This explains how to work with PowerApps Search Integer.


  • As we know, Every data source has some limits in PowerApps. Similarly, the PowerApps Search function has also a certain limit i.e. 500.
  • If you have more than 500 items in your data source, then you can not get those items after 500. Then in this case, you will get some warning message in the app which is known as PowerApps Delegation issues.
  • To overcome this issue, what are the instructions you need to follow, everything you will get to know from the provided link: PowerApps Search Limit

Suppose you want to search and filter the gallery records based upon the PowerApps Listbox selection, then check out the below simple scenario.

  • In the below image, you can see there is a List Box control, and a Gallery control. The list box contains all the values from a SharePoint Choice field.
  • Now what I would like to do is, when a user will select any value from the list box, then the gallery will filter based upon the selected value.
  • For example, I selected the value as PDF from the list box, then the gallery filtered and displayed only the PDF related record details as shown below.
PowerApps listbox search
PowerApps Listbox search
  • This below represents the SharePoint list named TSInfo Attachments. This list has a Choice field called Attachment Types. I want all the choice values from this field will appear in the PowerApps list box control.
Power Apps listbox search
Power Apps Listbox search
  • To do so, insert a List box and set its Items property to the below code:
Items = Choices('TSInfo Attachments'.'Attachment Types').Value

As the Attachment Types field is a SharePoint Choice field, that’s why we need to write the formula with a .Value parameter.

Listbox search in PowerApps
Listbox search in PowerApps
  • Then, we will create a context variable on the List box’s OnSelect property as:
OnSelect = UpdateContext({vSelectedItems: lbSelectDocType.Selected.Value})

Where,

  1. vSelectedItems = Specify the Context variable name
  2. lbSelectDocType = List box control name
Listbox search in Power Apps
  • Now select the gallery control and apply the below formula on its Items property as:
Items = Filter(
    'TSInfo Attachments',
    'Attachment Types'.Value in vSelectedItems
)

Where,

  1. TSInfo Attachments’ = SharePoint list name
  2. ‘Attachment Types’.Value = SharePoint Choice field
  3. vSelectedItems = Context variable name that you have created before

Refer to the below screenshot.

PowerApps List box search
PowerApps List box search

This is how to work with PowerApps Listbox Search.

Do you want to search with multiple keywords and filter the gallery control in PowerApps? Check out the below simple scenario that how you can achieve it.

  • In the app, insert a Text input control, a button control (Click Me), and a gallery control as like the below screenshot. So when a user will click on the button, then a data collection will create.
  • When the search box is empty, then the gallery will display with all the collection records. But when the user will search one or more keywords in the search box, then the gallery will filter according to that specific searchable keyword.
PowerApps search multiple words
PowerApps search multiple words
  • To achieve this, first we will create a PowerApps Collection on the button onclick. Select the Button (Click Me) and write the below code on its OnSelect property as:
OnSelect = ClearCollect(
    colEmpDetails,
    "Shane",
    "TSInfo202",
    "FINANCE",
    "Casual Leave"
)

Where,

  1. ClearCollect = PowerApps ClearCollect function is a type of function that removes all the records from a collection. And then it adds a different set of records to the same collection. To read more details, refer to this complete tutorial: Create Collection from SharePoint List in PowerApps
  2. colEmpDetails = Specify the created collection name
  3. Shane“, “TSInfo202“, etc. = These are the records that will store in the collection
Power Apps search multiple words
Power Apps search multiple words
  • Next, apply the below formula on Gallery’s Items property as:
Items = If(
    IsBlank(txtSearchWords.Text),
    RenameColumns(
        colEmpDetails,
        "Value",
        "Result"
    ),
    Distinct(
        Ungroup(
            ForAll(
                Filter(
                    Split(
                        Lower(txtSearchWords.Text),
                        ","
                    ),
                    !IsBlank(Result)
                ),
                Filter(
                    colEmpDetails,
                    !IsBlank(
                        Find(
                            TrimEnds(Result),
                            Lower(Value)
                        )
                    )
                )
            ),
            "Value"
        ),
        Value
    )
)

Where,

txtSearchWords = Text input control name

PowerApps search multiple keywords
PowerApps search multiple keywords
  • Save, Publish, and then Preview the app. Tap on the button (Click Me) and you can see the collection created and display all the values in the gallery. Now search some keywords in the search text box, you can able to see the filtered result in the gallery.

This explains how to work with search multiple words in PowerApps.

Do you want to search and filter the record with the click of a button? Yes, you can do it very easily. Refer to the below example.

  • There is a Text input control, a Button control (Enter), and a Gallery control. A user will search the Product name in the search box, and then tap on the button. Once the user click on it, the gallery will filter and display with all searchable related record details as shown below.
PowerApps search on button click
PowerApps search on button click
  • To achieve this, you need to create a context variable on the button’s OnSelect property as:
OnSelect = UpdateContext({searchTerm: txtSearchTitle.Text})

Where,

  1. searchTerm = Context variable name
  2. txtSearchTitle = Specify the text input control name
Power Apps search on button click
Power Apps search on button click
  • Next, select the gallery control and apply the below code on its Items property as:
Items = Search(
    Products,
    searchTerm,
    "Title"
)

Where,

  1. Products = SharePoint list name
  2. searchTerm = Context variable name that you have created on the button
  3. “Title” = SharePoint text column
Power Apps search button click
Power Apps search button click
  • Save, Publish the app. Now Preview the app and search any product title in the search box and then click on the Enter button. Then you can view the filtered result in the gallery as shown above.

This is how to work with PowerApps search on button click.

In this topic, we will see how to work with the PowerApps Search box.

  • I have a SharePoint list named Blog Sites. This list has these many below columns with different data types as:
  1. Title = By default this is a single line of text field
  2. Site URLSite RankSite Work = These all are single line of text fields
Search box in PowerApps
Search box in PowerApps
  • In the below screenshot, you can see there is a gallery control and a text input control. Now what I want to do is, when a user will search the blog title in the search box, then the gallery will filter and display with the filtered record details.
  • For example, as I searched the title SharePoint, so the gallery filtered and appeared with SharePoint details as shown below.
PowerApps search box
PowerApps search box
  • To work with this, select the gallery control and apply the below formula on its Items property as:
Items = SortByColumns(
    Filter(
        'Blog Sites',
        StartsWith(
            Title,
            txtEnterTitle.Text
        )
    ),
    "SiteWork"
)

Where,

  1. ‘Blog Sites’ = SharePoint list name
  2. Title = Specify the Sharepoint field name that you want to search in the text box
  3. txtEnterTitle = Text input control name
Power Apps search box
Power Apps search box
  • To display the Title field in the gallery, make sure to set the Text property of the label inside the gallery as:
Text = ThisItem.Title

This is how to work with the search boxes in PowerApps.

Do you want to reset or clear the search text box in Power Apps? You can reset the text box very easily by a single formula itself.

  • In apps what happens is, suppose you are searching something in a search text box and then navigating to the other screen for some purposes.
  • Again when you came back to the previous screen, you can able to see the same search keyword that you were searching before. But you do not need that. Instead of that keyword, you want to reset the search box in the app.
  • To workaround with this, I got two things or formulas that you can try out and get it done.

Example – 1:

  • To achieve this, you can insert a Button control (named as RESET) and set its OnSelect property to the below code as:
OnSelect = Reset(txtBtnReset) 

Where,

txtBtnReset = Text input control name

PowerApps reset search box
PowerApps reset search box
  • Now save and preview the app. Search any keyword in the search box and then tap on the RESET button. You can see the searching word will clear from the text box.

Example – 2:

In another way, we can try out the below codes to clear the search box in PowerApps.

  • First, we need to create a context variable on the Button’s OnSelect property as:
OnSelect = UpdateContext({ClearSearch: true});
UpdateContext({ClearSearch: false})

Where,

ClearSearch = Context Variable name

Power Apps reset search box
Power Apps reset search box
  • Next, select the search input box and make its Clear property to false as shown below.
Clear = false

Here, you need to make sure you don’t have two buttons to clear the control in the app.

Power Apps clear search box
Power Apps clear search box
  • At last, go to the Reset property of the text input control and set the created context variable on it.
Reset = ClearSearch
Clear search box in Power Apps
Clear search box in Power Apps
  • Now save and preview the app. Search any keyword in the search box and then tap on the RESET button. You can see the searching word will clear from the text box.

These are the two ways where you can reset the search box in PowerApps.


In this topic, we will discuss how to Search the Date range in PowerApps. The range in between two dates is known as the Date range. Now to work with the date range in PowerApps, check out the below scenario.

  • In this example, I have a SharePoint List named Products that is having different types of fields. Now in PowerApps, I would like to create a gallery that will show the last 30 days of product sales details.
  • When a user will select any of the product from the dropdown control, then the gallery will filter and display any products sold to the list with that product type.
  • To achieve this, select the gallery and set its Items property to the below code:
Items = Filter(
    Products,
    Title = ddSelectProduct.Selected.Title && 'Sales Date' >= DateAdd(
        Today(),
        -30,
        Days
    )
)

Where,

  1. Products = SharePoint List name
  2. Title = SharePoint text field
  3. ddSelectProuct = Dropdown control name where a user can select any product
  4. Sales Date‘ = SharePoint Date field name

Refer to the below screenshot.

PowerApps Search Date range
PowerApps Search Date range

This is how to work with PowerApps Search Date range.


Here in this topic, we will see what is PowerApps count search results.

  • As we know, we can count all the items those are available in the PowerApps Gallery or Data table control. But instead of that, if you want to count the total records that are filtered in the gallery or data table control, then what and how the exact formula will apply. To do this, follow the below example.
  • In the below image, you can see, when I searched the product as Laptop, then the gallery filtered and displayed the search related result details. Here, I wanted to count all the filtered records in the gallery.
  • As the gallery filtered result count is 4, so the count result is displayed in the label control as shown below.
PowerApps count search results
PowerApps count search results
  • To work around with this, apply the below code on the data table’s Items property as:
Items = Filter(
    Products,
    Title = txtSearchProduct.Text
)

Where,

  1. Products = SharePoint List Name
  2. Title = Sharepoint text field
  3. txtSearchProduct = Text input control name
Power Apps Count Search Results
Power Apps Count Search Results
  • Next, select the label and set the below formula on it’s Text property as:
Text = "Total Search Result: " & CountIf(
    Products,
    Products[@Title] = txtSearchProduct.Text
)

Where,

  1. Total Search Result: ” = This is the string that will display in the label control
  2. CountIf = PowerApps CountIf function helps to count the total number of items or records in a table that are true. To read more details about CountIf function, refer to this post: PowerApps CountIf Function with Examples

Refer to the below image.

Count Search Results in PowerApps
Count Search Results in PowerApps

This is how to work with PowerApps Count Search Results.


Do you want to search any record by using the PowerApps Combo Box control? Check out the below example that how you can work with it.

  • As you can see there is a Combo box control and a Gallery control. When you will search the customer name (s) from the combo box, then all the search-related records will appear in the gallery control.
PowerApps search combobox
PowerApps search combobox
  • To workaround with this, set the below code on Combo box’s Items property as:
Items = Products.'Customer Name'

Where,

  1. Products = SharePoint List name
  2. ‘Customer Name’ = SharePoint single line of text column
search combobox in PowerApps
search Combobox in PowerApps
  • Next, apply the below formula on gallery’s Items property as:
Items = Filter(
    Products,
    'Customer Name' in ComboBox2.SelectedItems
)

Where,

ComboBox2 = Specify the name of the combo box control

Power Apps search combobox
Power Apps search combobox

This is how to work with PowerApps search Combobox.



Git Basic working

  Develop = dev   r