cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

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
Highlighted
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
Highlighted
Regular Visitor

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

Highlighted
Regular Visitor

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))

Highlighted
Community Champion
Community Champion

Re: wildcard between 2 search criterias

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

Highlighted
Regular Visitor

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

Highlighted
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
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (5,227)