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
Super User III
Super User III

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

Super User III
Super User III

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,501)