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

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

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

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

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

Highlighted

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

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!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,171)