cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
andremoraes
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

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

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

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

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

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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,632)