0
votes

I am struggling to use the OR function in my Powerapp

I have

SortByColumns(Filter(Scopes, StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

and also

SortByColumns(Filter(Scopes, StartsWith(Title, BarcodeScanner1.Value)), "Title", If(SortDescending1, Descending, Ascending))

But I want to combine it so it shows the value of the Barcodescanner 1 or the text box search

I tried

SortByColumns(Filter(Scopes, StartsWith(Title, OR(TextSearchBox1.Text,BarcodeScanner1.Value))), "Title", If(SortDescending1, Descending, Ascending))

but this doesn't work...

Any tips?

2

2 Answers

0
votes

The Or function takes two logical (true/false) values as parameters, so you can try this expression:

SortByColumns(
    Filter(
        Scopes,
        Or(
            StartsWith(Title, TextSearchBox1.Text),
            StartsWith(Title, BarcodeScanner1.Value))),
    "Title",
    If(SortDescending1, Descending, Ascending))
0
votes

You can try using || condition to filter out , based on 2 different values from Scopes.

SortByColumns(
    Filter(
        Scopes,
            StartsWith(Title, TextSearchBox1.Text) || StartsWith(Title, BarcodeScanner1.Value)
            ),
    "Title",
    If(SortDescending1, Descending, Ascending))