cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
JomarGF
Level: Powered On

HELP! - Filter collection based on dropdown

Hi everyone

 

The combo and drop down boxes isBlank state doesn't work, other combination does. Spending hours trying to figure out why.

 

The Combo Box (Show All) accepts multiple selection (see attached). The DropDown (Level) accepts one value. There are hidden text boxes under the combo and dropdown (txtCatA and txtTestLevA). Both textboxes gets their values from the combo and dropdowns above them and used their values in the attached code as items source for gallery items. 

 

The "check box" (its a label - #mdevaney) have three possible values when pressed ("null" - show all, "ticked" - show ticked values, "unticked" - show unticked values)

 

As mentioned, when both Combo and Dropdown is blank, the toggle (check box) doesn't produce the filtered result, other option (when not blank) works fine. 😞

 

I hope this is enough description. Assistance is very much appreciated.

 

Thank you.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
JomarGF
Level: Powered On

Re: HELP! - Filter collection based on dropdown


@JomarGF wrote:

Hi everyone.

 

I am in the process of solving this myself. 

 

Thank you for the ones who spent time analysing the code.

 

I will post my solution later. 🙂

 

Cheers!



@JomarGF wrote:

Hi everyone.

 

I am in the process of solving this myself. 

 

Thank you for the ones who spent time analysing the code.

 

I will post my solution later. 🙂

 

Cheers!




Sort( Switch( checkboxState, "null", If( IsBlank(txtTestCatA.Text) And IsBlank(txtTestLevA.Text) And checkboxState = "null", collPropAssets, If( !IsBlank(txtTestCatA.Text) And IsBlank(txtTestLevA.Text) And checkboxState = "null", Filter( collPropAssets, TestingRoutineDesc in cmbCatA.SelectedItems ), If( IsBlank(txtTestCatA.Text) And !IsBlank(txtTestLevA.Text) And checkboxState = "null", Filter( collPropAssets, AssetLocLevel in cmbLevelA.SelectedItems ), Filter( collPropAssets, TestingRoutineDesc in cmbCatA.SelectedItems And AssetLocLevel in cmbLevelA.SelectedItems ) ) ) ), "ticked", If( IsBlank(txtTestCatA.Text) And IsBlank(txtTestLevA.Text) And checkboxState = "ticked", Filter( collPropAssets, chkYesNo = true ), If( !IsBlank(txtTestCatA.Text) And IsBlank(txtTestLevA.Text) And checkboxState = "ticked", Filter( collPropAssets, TestingRoutineDesc in cmbCatA.SelectedItems And chkYesNo = true ), If( IsBlank(txtTestCatA.Text) And !IsBlank(txtTestLevA.Text) And checkboxState = "ticked", Filter( collPropAssets, AssetLocLevel in cmbLevelA.SelectedItems And chkYesNo = true ), Filter( collPropAssets, TestingRoutineDesc in cmbCatA.SelectedItems And AssetLocLevel in cmbLevelA.SelectedItems And chkYesNo = true ) ) ) ), "unticked", If( IsBlank(txtTestCatA.Text) And IsBlank(txtTestLevA.Text) And checkboxState = "unticked", Filter( collPropAssets, chkYesNo = false ), If( !IsBlank(txtTestCatA.Text) And IsBlank(txtTestLevA.Text) And checkboxState = "unticked", Filter( collPropAssets, TestingRoutineDesc in cmbCatA.SelectedItems And chkYesNo = false ), If( IsBlank(txtTestCatA.Text) And !IsBlank(txtTestLevA.Text) And checkboxState = "unticked", Filter( collPropAssets, AssetLocLevel in cmbLevelA.SelectedItems And chkYesNo = false ), Filter( collPropAssets, TestingRoutineDesc in cmbCatA.SelectedItems And AssetLocLevel in cmbLevelA.SelectedItems And chkYesNo = false ) ) ) ) ), AssetNo, If( SortDescending1, Descending, Ascending ) )

View solution in original post

7 REPLIES 7
cds
Level 8

Re: HELP! - Filter collection based on dropdown

can you post your Gallery Items function

JomarGF
Level: Powered On

Re: HELP! - Filter collection based on dropdown

Attached - gallery items function 

JomarGF
Level: Powered On

Re: HELP! - Filter collection based on dropdown

Switch(checkboxState,"null", 

Sort(
    If(
        IsBlank(txtTestCatA.Text) And IsBlank(txtTestLevA.Text) And checkboxState = "null",
        collPropAssets,
        If(
         !IsBlank(txtTestCatA.Text) And IsBlank(txtTestLevA.Text) And checkboxState = "null",    
         Filter(
            collPropAssets,
            TestingRoutineDesc in cmbCatA.SelectedItems
        ),
        If(
         IsBlank(txtTestCatA.Text) And !IsBlank(txtTestLevA.Text)And checkboxState = "null",
         Filter(
            collPropAssets,
            AssetLocLevel in cmbLevelA.SelectedItems
        ),
         Filter(
            collPropAssets,
             TestingRoutineDesc in cmbCatA.SelectedItems And AssetLocLevel in cmbLevelA.SelectedItems
        )))
    ),
    AssetNo,
    If(
        SortDescending1,
        Descending,
        Ascending
    )
),
"ticked",
Sort(
    If(
        IsBlank(txtTestCatA.Text) And IsBlank(txtTestLevA.Text) And checkboxState = "ticked",
        collPropAssets,
        If(
         !IsBlank(txtTestCatA.Text) And IsBlank(txtTestLevA.Text) And checkboxState = "ticked",    
         Filter(
            collPropAssets,
            TestingRoutineDesc in cmbCatA.SelectedItems And chkYesNo 
        ),
        If(
         IsBlank(txtTestCatA.Text) And !IsBlank(txtTestLevA.Text) And checkboxState = "ticked",
         Filter(
            collPropAssets,
            AssetLocLevel in cmbLevelA.SelectedItems And chkYesNo
        ),
         Filter(
            collPropAssets,
             TestingRoutineDesc in cmbCatA.SelectedItems And AssetLocLevel in cmbLevelA.SelectedItems And chkYesNo
        )))
    ),
    AssetNo,
    If(
        SortDescending1,
        Descending,
        Ascending
    )
),
"unticked",
Sort(
    If(
        IsBlank(txtTestCatA.Text) And IsBlank(txtTestLevA.Text) And checkboxState = "unticked",
        collPropAssets,
        If(
         !IsBlank(txtTestCatA.Text) And IsBlank(txtTestLevA.Text) And checkboxState = "unticked",    
         Filter(
            collPropAssets,
            TestingRoutineDesc in cmbCatA.SelectedItems And !chkYesNo
        ),
        If(
         IsBlank(txtTestCatA.Text) And !IsBlank(txtTestLevA.Text) And checkboxState = "unticked",
         Filter(
            collPropAssets,
            AssetLocLevel in cmbLevelA.SelectedItems And !chkYesNo
        ),
         Filter(
            collPropAssets,
             TestingRoutineDesc in cmbCatA.SelectedItems And AssetLocLevel in cmbLevelA.SelectedItems And !chkYesNo
        )))
    ),
    AssetNo,
    If(
        SortDescending1,
        Descending,
        Ascending
    )
))
JomarGF
Level: Powered On

Re: HELP! - Filter collection based on dropdown

Hi everyone.

 

I am in the process of solving this myself. 

 

Thank you for the ones who spent time analysing the code.

 

I will post my solution later. 🙂

 

Cheers!

JomarGF
Level: Powered On

Re: HELP! - Filter collection based on dropdown


@JomarGF wrote:

Hi everyone.

 

I am in the process of solving this myself. 

 

Thank you for the ones who spent time analysing the code.

 

I will post my solution later. 🙂

 

Cheers!



@JomarGF wrote:

Hi everyone.

 

I am in the process of solving this myself. 

 

Thank you for the ones who spent time analysing the code.

 

I will post my solution later. 🙂

 

Cheers!




Sort( Switch( checkboxState, "null", If( IsBlank(txtTestCatA.Text) And IsBlank(txtTestLevA.Text) And checkboxState = "null", collPropAssets, If( !IsBlank(txtTestCatA.Text) And IsBlank(txtTestLevA.Text) And checkboxState = "null", Filter( collPropAssets, TestingRoutineDesc in cmbCatA.SelectedItems ), If( IsBlank(txtTestCatA.Text) And !IsBlank(txtTestLevA.Text) And checkboxState = "null", Filter( collPropAssets, AssetLocLevel in cmbLevelA.SelectedItems ), Filter( collPropAssets, TestingRoutineDesc in cmbCatA.SelectedItems And AssetLocLevel in cmbLevelA.SelectedItems ) ) ) ), "ticked", If( IsBlank(txtTestCatA.Text) And IsBlank(txtTestLevA.Text) And checkboxState = "ticked", Filter( collPropAssets, chkYesNo = true ), If( !IsBlank(txtTestCatA.Text) And IsBlank(txtTestLevA.Text) And checkboxState = "ticked", Filter( collPropAssets, TestingRoutineDesc in cmbCatA.SelectedItems And chkYesNo = true ), If( IsBlank(txtTestCatA.Text) And !IsBlank(txtTestLevA.Text) And checkboxState = "ticked", Filter( collPropAssets, AssetLocLevel in cmbLevelA.SelectedItems And chkYesNo = true ), Filter( collPropAssets, TestingRoutineDesc in cmbCatA.SelectedItems And AssetLocLevel in cmbLevelA.SelectedItems And chkYesNo = true ) ) ) ), "unticked", If( IsBlank(txtTestCatA.Text) And IsBlank(txtTestLevA.Text) And checkboxState = "unticked", Filter( collPropAssets, chkYesNo = false ), If( !IsBlank(txtTestCatA.Text) And IsBlank(txtTestLevA.Text) And checkboxState = "unticked", Filter( collPropAssets, TestingRoutineDesc in cmbCatA.SelectedItems And chkYesNo = false ), If( IsBlank(txtTestCatA.Text) And !IsBlank(txtTestLevA.Text) And checkboxState = "unticked", Filter( collPropAssets, AssetLocLevel in cmbLevelA.SelectedItems And chkYesNo = false ), Filter( collPropAssets, TestingRoutineDesc in cmbCatA.SelectedItems And AssetLocLevel in cmbLevelA.SelectedItems And chkYesNo = false ) ) ) ) ), AssetNo, If( SortDescending1, Descending, Ascending ) )

View solution in original post

JomarGF
Level: Powered On

Re: HELP! - Filter collection based on dropdown

Special thanks to @mdevaney!

mdevaney
Level 8

Re: HELP! - Filter collection based on dropdown

@JomarGF
No problem dude. Happy (Canadian) Thanksgiving!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 315 members 5,180 guests
Recent signins:
Please welcome our newest community members: