cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver I
Resolver I

DataCards Conditional Visible based on Multi Select Combo Box

Hi there,

 

I have an app where i have a combo box with multi-select  options. I want to show/hide datacards based on the options selected in the combo box. In the the "visible" control of the datacards i want to show/hide, i have the following formula:

 

If("Fluoro Recycling" in (WastDrop.Selected.Value),true,false)

 

This seems to work perfectly if I select a single option from the drop down list. The datacard appears and data can be entered. However, if i select multiple items from the drop down list, i will still only see a single data card (usually the last one selected).  

Any idea how i can get all the datacards selected to show up?

 

Thanks 🙂

 

Cym

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: DataCards Conditional Visible based on Multi Select Combo Box

I recreated your use case. I have a CDS option set called 'Category (Accounts)' and the Items property of the combo box (ComboBox21 in my case) is set to 

Items = Choices('Category (Accounts)')

The option set has two values: Preferred Customer and Standard

 

I then have 2 labels (trying to mimic your data cards):

1. Label1 has

Text = "Preferred Customer" 

and

Visible = If(!IsBlank(LookUp(ComboBox21.SelectedItems, Text(Value) = "Preferred Customer")), true, false) 

2. Label2 has

Text = "Standard"

and

Visible = If(!IsBlank(LookUp(ComboBox21.SelectedItems, Text(Value) = "Standard")), true, false) 

 

This achieves what I think you set out to. Here is a working demo: 

ComboSelectedItems.gif

 

Let me know if this helps and if you want to know why I did it this way. 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
https://thepoweraddict.com

 

View solution in original post

11 REPLIES 11
Highlighted
Super User
Super User

Re: DataCards Conditional Visible based on Multi Select Combo Box

Try

If("Fluoro Recycling" in (WastDrop.SelectedItems),true,false)

Let me know if this helps.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
The Power Addict
https://thepoweraddict.com
Highlighted
Resolver I
Resolver I

Re: DataCards Conditional Visible based on Multi Select Combo Box

Thanks @PowerAddict , but doesn't seem to work :

 

Error Says: Can't convert this data type. Ppower Apps can't convert this Text to a OptionSetValue (see attached).

Highlighted
Super User
Super User

Re: DataCards Conditional Visible based on Multi Select Combo Box

Fair enough. I am assuming that "Fluro Cycling" is one of the options of an OptionSet. Is that correct?

If so, change the formula to:
If(OptionSet.'Fluoro Recycling' in (WastDrop.SelectedItems),true,false)

Let me know if this helps.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
The Power Addict
https://thepoweraddict.com
Highlighted
Resolver I
Resolver I

Re: DataCards Conditional Visible based on Multi Select Combo Box

Hi @PowerAddict.,

You are correct, that it is one of the options in a CDS option set. I've tried the formula you have proposed, but sadly still no luck!!  Any other ideas?

 

Thanks so much for your help!

 

Highlighted
Super User
Super User

Re: DataCards Conditional Visible based on Multi Select Combo Box

My apologies, I am finally in front of a computer now. Can you please tell me what the Items property of the combo box is? Also, did you get an error with the above formula?

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
https://thepoweraddict.com
Highlighted
Resolver I
Resolver I

Re: DataCards Conditional Visible based on Multi Select Combo Box

Don't apologise! I appreciate the help!

 

The items property of the combo box is set to: Choices('Waste Type')

 

Several errors:

Expected Operator.....

Unexpected characters. The formula contains 'ident' where 'fluoro recyling' is expected

 

 

Highlighted
Super User
Super User

Re: DataCards Conditional Visible based on Multi Select Combo Box

I recreated your use case. I have a CDS option set called 'Category (Accounts)' and the Items property of the combo box (ComboBox21 in my case) is set to 

Items = Choices('Category (Accounts)')

The option set has two values: Preferred Customer and Standard

 

I then have 2 labels (trying to mimic your data cards):

1. Label1 has

Text = "Preferred Customer" 

and

Visible = If(!IsBlank(LookUp(ComboBox21.SelectedItems, Text(Value) = "Preferred Customer")), true, false) 

2. Label2 has

Text = "Standard"

and

Visible = If(!IsBlank(LookUp(ComboBox21.SelectedItems, Text(Value) = "Standard")), true, false) 

 

This achieves what I think you set out to. Here is a working demo: 

ComboSelectedItems.gif

 

Let me know if this helps and if you want to know why I did it this way. 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
https://thepoweraddict.com

 

View solution in original post

Highlighted
Resolver I
Resolver I

Re: DataCards Conditional Visible based on Multi Select Combo Box

You legend! That totally seems to have worked!  I'd love to understand that logic, as i don't think i could have figured it out.

Highlighted
Super User
Super User

Re: DataCards Conditional Visible based on Multi Select Combo Box

Glad I could help!

Here's my approach as to how I figured it out:
1. So, option sets are like tables, so although the values in them seem like text, they are not really text.
2. With that understanding, I knew I had to reference the option set value in the If condition as OptionSet.Option1 and not "Option1".
3. Then the "in" condition was still not working because that, to the best of my understanding, is used to check if a string exists in a table or a collection. Since this isnt a string, it wont work.
4. Given this is just like a CDS entity, the way I use to check if a value exists in an entity is by using LookUp, I decided to use the same here and it worked!

It was a good refresher for me, so thank you for posting this!

Good luck with the rest of your app! Feel free to reach out in case of any questions!

Thanks,
Hardit Bhatia
The Power Addict
https://thepoweraddict.com

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,217)