In this Power Apps tutorial, I will explain the Power Apps Find function and its syntax. Then, I will show you how to use the Power Apps Find function using different examples like:
- Power Apps Find Character in String
- Power Apps Search Text in String
- Power Apps Contains Text
Power Apps Find Function
The Power Apps Find function finds a string within another string. Normally, this function searches a string of text and it is case-sensitive.
Note:
Power Apps Find function always returns the first character of the string. If the string is does not contain, you can get a blank value.
Power Apps Find Function Syntax
Find( FindString, WithinString [, StartingPosition ] )
Where,
- FindString = This is required. Specify the string to find
- WithinString = This is also required. Provide the string to search within
- StartingPosition = This is an Optional. It specifies the starting position in which to start searching. Position 1 is the first character
How to Use Power Apps Find Function
Here, we will see how to use the Power Apps Find function using different examples. Such as:
Example-1:
In Power Apps, there is a Text label containing the text [“Microsoft Power Platform”]. Now, I would like to find the starting position of the text/string [“Platform“]. For that, follow the code below.
Text = Find(
"Platform",
"Microsoft Power Platform"
)
Output:
Example-2:
Suppose you want to find the starting position of the first occurrence of “Canvas” after the 10th character. Insert a Text label and set its Text property to the code below.
Text = Find(
"Canvas",
"PowerApps Canvas, PowerApps Canvas",
10
)
Example-3:
Let’s say there are two text labels. The first text label contains the text [Power Apps Developer]; now, I want to find the starting position of the string [“Apps“] and display the result on the second text label.
For that, set the second Text label’s Text property using the code below.
Text = Find(
"Apps",
txt_text.Text
)
Where,
- txt_text = Second text label name
Example-4:
Suppose you have a string “Power Apps Developer,” and you want to find the position of the word “apps”. In this case, insert a Text label and set its Text property to the code below.
Text = Find(
"apps",
Lower("Power Apps Developer")
)
Example-5:
Suppose your FindString [“Canvas“] is not in the WithinString [“Microsoft Power Platform”]. In this case, you will get the result as Blank, as shown below. Refer to the code below.
Text = Find(
"Canvas",
"Microsoft Power Platform"
)
Power Apps Find Character in String
Now, I will discuss how to work with the Power Apps find character in string with a simple scenario:
Scenario:
Suppose there is a string “Welcome to Power Apps!” and I want to find the position of the character “P.” For that, follow the below code.
Text = Find(
"P",
"Welcome to Power Apps!"
)
This is how we can work with the Power Apps find character in string.
Power Apps Search Text in String
In Power Apps, there are two Text input controls. The first text input control contains the text [Welcom to Power Apps], and the second text input control contains the text [Power Apps].
I want to search text in a string using the Find function and display the result on the text label. Refer to the below code.
Text = Find(
txt_Text.Value,
txt_String.Value
)
This way, we can work with the Power Apps Search Text in String.
Power Apps Contains Text
Suppose you have a string “Microsoft Power Platform,” and I want to check if it contains the word “Microsoft.” To do so, insert a Text label and set its Text property using the code below.
Text = If(
Find(
"Microsoft",
"Microsoft Power Platform"
) > 0,
"Contains",
"Does not contain"
)
Similarly, if the string does not contain the text, it will display the result as “Does not contain”, as shown below.
This way, we can work with the Power Apps contains text.
Moreover, you may like some more Power Apps tutorials:
- 12 Useful Power Apps Sort Gallery Examples
- Power Apps Search Function Examples
- Power Apps Combo Box Control
- Send Email From Power Apps
- 4 Various Power Apps Mod Function Examples
This tutorial taught us the Power Apps Find function, its syntax, and examples of the Find function. We also discussed the Power Apps find character in a string and the Power Apps search text in a string.
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com