cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
marczh
Frequent Visitor

Search Filter and Sort Gallery

Hi

I tried searching, filtering and sorting my gallery and almost suceeded 😉

 

I get the text box, the sort functions and one drop down filter to work, but when i try to include the second drop down filter, I fail.

 

marczh_0-1631798367332.png

With this code, the first drop down is working just fine.

SortByColumns(
    Search(
        If(
            DropdownStatus.Selected.Result = "Alle";
            'Reporting Vermietung';
            Filter(
                'Reporting Vermietung';
                'Status Text' = DropdownStatus.Selected.Result
            )
        );
        TextSearchBox1_1.Text;
        "Objekt";
        "PFM";
        "Status_x0020_Text";
        "Mieter"
    );
    SortColumn;
    If(
        SortDescending1;
        Descending;
        Ascending
    )
)

I tried to include the second filter drop down like this, but it's not working properly:

SortByColumns(
    Search(
        If(
            DropdownStatus.Selected.Result = "Alle" || DropdownPFM.Selected.Result = "Alle";
            'Reporting Vermietung';
            Filter(
                'Reporting Vermietung';
                'Status Text' = DropdownStatus.Selected.Result || PFM = DropdownPFM.Selected.Result
            )
        );
        TextSearchBox1_1.Text;
        "Objekt";
        "PFM";
        "Status_x0020_Text";
        "Mieter"
    );
    SortColumn;
    If(
        SortDescending1;
        Descending;
        Ascending
    )
)

Many thanks in advance 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
StalinPonnusamy
Community Champion
Community Champion

Hi @marczh

 

Both Dropdown selection is optional now.

With(
    {_Item: 'Reporting Vermietung'};
SortByColumns(
    Search(
Filter(
                _Item,
                (DropdownStatus.Selected.Result = "Alle" || 'Status Text' = DropdownStatus.Selected.Result) && (DropdownPFM.Selected.Result = "Alle" || PFM = DropdownPFM.Selected.Result)
            );
        TextSearchBox1_1.Text;
        "Objekt"
        "PFM";
        "Status_x0020_Text";
        "Mieter"
    );
    SortColumn;
    If(
        SortDescending1;
        Descending;
        Ascending
    )
)
)

 

 

 

View solution in original post

5 REPLIES 5
StalinPonnusamy
Community Champion
Community Champion

Hi @marczh

 

Please try this

With(
    {_Item: 'Reporting Vermietung'};
SortByColumns(
    Search(
        If(
            DropdownStatus.Selected.Result = "Alle" || DropdownPFM.Selected.Result = "Alle";
            _Item;
            Filter(
                _Item;
                'Status Text' = DropdownStatus.Selected.Result || PFM = DropdownPFM.Selected.Result
            )
        );
        TextSearchBox1_1.Text;
        "Objekt";
        "PFM";
        "Status_x0020_Text";
        "Mieter"
    );
    SortColumn;
    If(
        SortDescending1;
        Descending;
        Ascending
    )
)
)

When I select the first dropdown nothing happens when I select the second drop down it is filtering something in a wrong weird way. The search box is working finde. Eventough there is no error message from the code. 

 

I think the problem is maybe in the Or Statement for the two filters?

 

 

marczh
Frequent Visitor

with this code 

 

With(
    {_Item: 'Reporting Vermietung'};
SortByColumns(
    Search(
        If(
            DropdownStatus.Selected.Result <> "Alle" Or DropdownPFM.Selected.Result <> "Alle";
            Filter(
                _Item;
                'Status Text' = DropdownStatus.Selected.Result Or PFM = DropdownPFM.Selected.Result
            );
            _Item
        );
        TextSearchBox1_1.Text;
        "Objekt";
        "PFM";
        "Status_x0020_Text";
        "Mieter"
    );
    SortColumn;
    If(
        SortDescending1;
        Descending;
        Ascending
    )
)
)

 

The Dropdowns are working but just if One of them is set to "Alle"

 

Is there a way they work both dynamically together despite the value of the other?

StalinPonnusamy
Community Champion
Community Champion

Hi @marczh

 

Both Dropdown selection is optional now.

With(
    {_Item: 'Reporting Vermietung'};
SortByColumns(
    Search(
Filter(
                _Item,
                (DropdownStatus.Selected.Result = "Alle" || 'Status Text' = DropdownStatus.Selected.Result) && (DropdownPFM.Selected.Result = "Alle" || PFM = DropdownPFM.Selected.Result)
            );
        TextSearchBox1_1.Text;
        "Objekt"
        "PFM";
        "Status_x0020_Text";
        "Mieter"
    );
    SortColumn;
    If(
        SortDescending1;
        Descending;
        Ascending
    )
)
)

 

 

 

View solution in original post

marczh
Frequent Visitor

@StalinPonnusamy Thank you very much, this works out just fine! Even if don't understand a 100% of the syntax 🙂

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Users online (2,499)