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

Search function that can look for more than one part of a string i.e. by using wildcards

Hi,

I do have a search box that is looking for parts of a text string to filter a gallery. Works fine. However, it would be much more powerful, when this search function could look for i.e two parts within the same text string.

 

For Example

Input in search box: 180

Result: all items that have "180" in the text string. I.e 180-10, 180mC, 180MC-10 LSE

 

Input in search box: 180 LSE

Result: Currently - no item because the sting "180 LSE" is not in the table. However, it would be great if with this two search terms the product 180MC-10 LSE would appear in the result.

 

Does PowerApps knows wildcards?

 

Thanks for your support

 

Regards - Andreas

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Search function that can look for more than one part of a string i.e. by using wildcards

Hi @AndreasGrosse ,

In PowerApps, you could use regular expression when compare data.

The common predefined patterns like ",.*%#" all work in PowerApps.

However, please note that regular expression could only refer constant value as format.

The data that you entered in textinput need to be used as Textinput.Text.

This is not constant value.

So using regular expression not work for this situation.

Here are some examples that could use regular expression to compare:

1)IsMatch( TextInput1.Text, "hello", Contains & IgnoreCase )

2)IsMatch( "<https://microsoft.com>", "(ht&#124;f)tp(s?)\:\/\/\[0-9a-zA-Z\]([-.\w]\*[0-9a-zA-Z])\*(:(0-9)\*)\*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]\*)?" )  

//all the format not contains variable

Here's a doc about regular expression in PowerApps for your reference:

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

 

In your situation, I suggest you try in or startswith/endwith function.

1)in

 

Filter(tablename,First(Split(TextInput1.Text," ")).Result in fieldname,Last(Split(TextInput1.Text," ")).Result in fieldname)

 

2)startswith/endwith function.

 

Filter(tablename,StartsWith(fieldname,First(Split(TextInput1.Text," ")).Result),
                 EndWith(fieldname,Last(Split(TextInput1.Text," ")).Result)
      )

 

// since you enter data in the same textinput, so I suggest you use split function to split it to two parts.

 

 

Best regards,

 

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
cds
Level 8

Re: Search function that can look for more than one part of a string i.e. by using wildcards

SearchInput.Text in Column.Name

Community Support Team
Community Support Team

Re: Search function that can look for more than one part of a string i.e. by using wildcards

Hi @AndreasGrosse ,

In PowerApps, you could use regular expression when compare data.

The common predefined patterns like ",.*%#" all work in PowerApps.

However, please note that regular expression could only refer constant value as format.

The data that you entered in textinput need to be used as Textinput.Text.

This is not constant value.

So using regular expression not work for this situation.

Here are some examples that could use regular expression to compare:

1)IsMatch( TextInput1.Text, "hello", Contains & IgnoreCase )

2)IsMatch( "<https://microsoft.com>", "(ht&#124;f)tp(s?)\:\/\/\[0-9a-zA-Z\]([-.\w]\*[0-9a-zA-Z])\*(:(0-9)\*)\*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]\*)?" )  

//all the format not contains variable

Here's a doc about regular expression in PowerApps for your reference:

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

 

In your situation, I suggest you try in or startswith/endwith function.

1)in

 

Filter(tablename,First(Split(TextInput1.Text," ")).Result in fieldname,Last(Split(TextInput1.Text," ")).Result in fieldname)

 

2)startswith/endwith function.

 

Filter(tablename,StartsWith(fieldname,First(Split(TextInput1.Text," ")).Result),
                 EndWith(fieldname,Last(Split(TextInput1.Text," ")).Result)
      )

 

// since you enter data in the same textinput, so I suggest you use split function to split it to two parts.

 

 

Best regards,

 

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

AndreasGrosse
Level: Powered On

Re: Search function that can look for more than one part of a string i.e. by using wildcards

Hello, sorry for my late reply but I had some other topics to do. 

 

I tried the solution with in and startswith/endwith. It did not work. Might my knowledge is not good enough to implement your ideas to my code. 

Here the code I entered using the startswith/endwith function. Data are populated to the catalogue but as soon as I put in a search term no results in the catalogue any more.

 

Here my input. My catalogue is filtered with some toggle buttons as well. 

 

Filter(Filter(PowerApps;
StartsWith(Category;First(Split(SearchInput.Text;" ")).Result);
EndsWith(Category;Last(Split(SearchInput.Text;" ")).Result)
;(Type = "Certificate"&&'T Certificate'.Value=true
Or Type = "Instruction Bulletin"&&'T Instruction Bulletin'.Value=true
Or Type = "Product Bulletin"&&'T Product Bulletin'.Value=true
Or Type = "MCS Table"&&'T MCS Table'.Value=true
Or Type = "Instruction Video"&&'T Video'.Value=true)
And (Language = "German"&&'T German'.Value=true
Or Language = "English"&&'T English'.Value=true
Or Language = "Spanish"&&'T Spanish'.Value=true
Or Language = "Italian"&&'T Italian'.Value=true
Or Language = "French"&&'T French'.Value=true))
;SearchInput.Text in Title Or SearchInput.Text in AdditionalSearchString Or SearchInput.Text in Category)

 

Thanks again for support

 

Regards - Andreas

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 (Last 30 Days)
Users online (3,769)