cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Dropdown conditional visibility

I have a multi-select dropdown DataCardValue47 containing values (Individual, Third Party, Contractors). 

 

I want to show/hide DataCard1 when

Selected values in the DataCardValue47 are Individual, Third Party, Contractors

OR

Individual, Third Party

OR

Individual, Contractors)

OR

Individual

 

Don't show when selected values are 

Third Party, Contractors

Third Party

Contractors

 

Visible

If(DataCardValue47.Selected.Value = "Individual", true, false) --- This condition works fine.

Please advise the correct logic. 

 

Logic i was trying
If(DataCardValue47.Selected.Value = "Individual", true, false) ||

If(DataCardValue47.Selected.Value in ["Individual","Third Party","Contractors"] but data card still shows when i just select Third Party or Contractors

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
melon
Frequent Visitor

@Anonymous 

I agree with @panand99  on the collection creation.

I did a test on this and created a ComboBox1 with 3 items ["Individual","Third Party","Contractors"] and a TextInput1 that will show the text "Show" or "Hide" based on the ComboBox1's selection.

ComboBox1 OnChange code:

Set(varSelection, ComboBox1.SelectedItems)

 

TextInput1 Default code:

If((CountRows(varSelection) = 1 && LookUp(varSelection, Value = "Third Party", Value) = "Third Party") ||
   (CountRows(varSelection) = 1 && LookUp(varSelection, Value = "Contractors", Value) = "Contractors") ||
   (CountRows(varSelection) = 2 && LookUp(varSelection, Value = "Contractors", Value) = "Contractors" && LookUp(varSelection, Value = "Third Party", Value) = "Third Party"), "Hide", "Show")

 

What it does is it checks the Count of the selection and the value of it. And then sets the text to Hide or Show accordingly.

 

 

View solution in original post

v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

I have made a test on my side, please take a try with the following workaround:6.JPG

 

7.JPG

 

8.JPG

Set the Items property of the Combo Box to following:

["Individual", "Third Party", "Contractors"]

Set the OnChange property of the Combo Box to following:

ClearCollect(SelectedOptions, ComboBox1.SelectedItems)

On your side, you should type:

ClearCollect(SelectedOptions, DataCardValue47.SelectedItems)

Set the Visible property of the Label control to following:

If(
    ("Individual" in SelectedOptions && "Third Party" in SelectedOptions && "Contractors" in SelectedOptions) ||
    ("Individual" in SelectedOptions && "Third Party" in SelectedOptions) ||
    ("Individual" in SelectedOptions && "Contractors" in SelectedOptions) ||
    ("Individual" in SelectedOptions),
    true,
    false
)

On your side, you should set the Visible property of the DataCard1 to following:

If(
    ("Individual" in SelectedOptions && "Third Party" in SelectedOptions && "Contractors" in SelectedOptions) ||
    ("Individual" in SelectedOptions && "Third Party" in SelectedOptions) ||
    ("Individual" in SelectedOptions && "Contractors" in SelectedOptions) ||
    ("Individual" in SelectedOptions),
    true,
    false
)

Please check the attached GIF screenshot for more details:Test.gif

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
panand99
Impactful Individual
Impactful Individual

@Anonymous 

 

you can create collection on onchange event of your dropdown and checked its value in your condition.

 

like dropdown onchange: ClearCollect(coll1,ComboBox3.SelectedItems)

 

and on a seperate text  field used: Concat(coll1,<your selection field name>,",")

 

and now you have all selection in a seperate text field. now you can use it.

melon
Frequent Visitor

@Anonymous 

I agree with @panand99  on the collection creation.

I did a test on this and created a ComboBox1 with 3 items ["Individual","Third Party","Contractors"] and a TextInput1 that will show the text "Show" or "Hide" based on the ComboBox1's selection.

ComboBox1 OnChange code:

Set(varSelection, ComboBox1.SelectedItems)

 

TextInput1 Default code:

If((CountRows(varSelection) = 1 && LookUp(varSelection, Value = "Third Party", Value) = "Third Party") ||
   (CountRows(varSelection) = 1 && LookUp(varSelection, Value = "Contractors", Value) = "Contractors") ||
   (CountRows(varSelection) = 2 && LookUp(varSelection, Value = "Contractors", Value) = "Contractors" && LookUp(varSelection, Value = "Third Party", Value) = "Third Party"), "Hide", "Show")

 

What it does is it checks the Count of the selection and the value of it. And then sets the text to Hide or Show accordingly.

 

 

v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

I have made a test on my side, please take a try with the following workaround:6.JPG

 

7.JPG

 

8.JPG

Set the Items property of the Combo Box to following:

["Individual", "Third Party", "Contractors"]

Set the OnChange property of the Combo Box to following:

ClearCollect(SelectedOptions, ComboBox1.SelectedItems)

On your side, you should type:

ClearCollect(SelectedOptions, DataCardValue47.SelectedItems)

Set the Visible property of the Label control to following:

If(
    ("Individual" in SelectedOptions && "Third Party" in SelectedOptions && "Contractors" in SelectedOptions) ||
    ("Individual" in SelectedOptions && "Third Party" in SelectedOptions) ||
    ("Individual" in SelectedOptions && "Contractors" in SelectedOptions) ||
    ("Individual" in SelectedOptions),
    true,
    false
)

On your side, you should set the Visible property of the DataCard1 to following:

If(
    ("Individual" in SelectedOptions && "Third Party" in SelectedOptions && "Contractors" in SelectedOptions) ||
    ("Individual" in SelectedOptions && "Third Party" in SelectedOptions) ||
    ("Individual" in SelectedOptions && "Contractors" in SelectedOptions) ||
    ("Individual" in SelectedOptions),
    true,
    false
)

Please check the attached GIF screenshot for more details:Test.gif

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks for the solution Kris Dai. This is what I wanted for my requirement.

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (4,469)