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

wildcard between 2 search criterias

I want to modify my filter criteria to something like 3-%3 to then just show card in the datatable item 3-0003

 

so my items formula would be slight <> (I hope) than:

 

SortByColumns(Filter(CardsData, StartsWith(BarCode,PrefixFilter.Selected.Result)),"BarCode",If(SortDescending1.Value,Descending,Ascending))

 

Any ideas? Is there a wildcard that I can use like % or * or ?

 

I guess I might have to combine a if function to check if the text input is not empty and if is it... above expression for the items will do it... otherwise will need to be something like

 

SortByColumns(Filter(CardsData, StartsWith(BarCode,PrefixFilter.Selected.Result) + "%" + SuffixFilter.Text),"BarCode",If(SortDescending1.Value,Descending,Ascending))

 

2017-12-28_13-12-02.png

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: wildcard between 2 search criterias

Hi @andremoraes

 

The main issue with the IsMatch function is that the match expression must be constant.

 

I think the 'isMatch has some invalid arguments' error relates to the fact that you're building the expression dynamically. In other words, I think this expression (3-.*3) would match item 3-0003 ....

 

SortByColumns(
   Filter(CardsData, IsMatch(BarCode,"3-.*3")), 
   "BarCode",
   If(SortDescending1.Value,Descending,Ascending)
)

Whereas the expression below would not work, because it is dynamically generated and refers to another control.

 

SortByColumns(
   Filter(CardsData, IsMatch(BarCode,PrefixFilter.Selected.Result & "-.*3"))), 
   "BarCode",
   If(SortDescending1.Value,Descending,Ascending)
)

View solution in original post

5 REPLIES 5
andremoraes
Level: Powered On

Re: wildcard between 2 search criterias

I tried the Search instead of Filter:

 

SortByColumns(Search(CardsData, lblFilter.Text,"BarCode"),"BarCode",If(SortDescending1.Value,Descending,Ascending))

 

and added a label filter to visualize the string for now to make it easier, with TEXT = PrefixFilter.Selected.Result & "*" & SuffixFilter.Text

 

both * or ? or % did not make the trick

andremoraes
Level: Powered On

Re: wildcard between 2 search criterias

This one made the trick - but would appreciate an easier solution if anyone knows how to use a wildcard

 

SortByColumns(Filter(CardsData, StartsWith(BarCode,PrefixFilter.Selected.Result) && EndsWith(BarCode,SuffixFilter.Text&"")), "BarCode",If(SortDescending1.Value,Descending,Ascending))

Meneghino
Level 10

Re: wildcard between 2 search criterias

I don't think wildcards are available yet in PowerApps.

andremoraes
Level: Powered On

Re: wildcard between 2 search criterias

is that not what the isMatch should be used for?

 

SortByColumns(Filter(CardsData, IsMatch(BarCode,"/" & PrefixFilter.Selected.Result & "\d*" & SuffixFilter.Text& "\d*/g")), "BarCode",If(SortDescending1.Value,Descending,Ascending))

 

I get one of those icons saying that my isMatch has some invalid arguments. I guess it might be because wants the first one to be a pure text vs. the datafield

Super User
Super User

Re: wildcard between 2 search criterias

Hi @andremoraes

 

The main issue with the IsMatch function is that the match expression must be constant.

 

I think the 'isMatch has some invalid arguments' error relates to the fact that you're building the expression dynamically. In other words, I think this expression (3-.*3) would match item 3-0003 ....

 

SortByColumns(
   Filter(CardsData, IsMatch(BarCode,"3-.*3")), 
   "BarCode",
   If(SortDescending1.Value,Descending,Ascending)
)

Whereas the expression below would not work, because it is dynamically generated and refers to another control.

 

SortByColumns(
   Filter(CardsData, IsMatch(BarCode,PrefixFilter.Selected.Result & "-.*3"))), 
   "BarCode",
   If(SortDescending1.Value,Descending,Ascending)
)

View solution in original post

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: 317 members 5,890 guests
Please welcome our newest community members: