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

How to use multiple Choices Function for the items property for a dropdown/combobox

 

What i am trying to achieve.

I want my combo box to display custom option set depending on another custom box. 

but the items are custom entities.

 

 

value 1.pngq2.png

8 REPLIES 8
Highlighted
Community Champion
Community Champion

Re: Conditional choices for items in a custom entity.

Hi @Anonymous ,

You do not need the Text references around the DataCardValues unless their value is numeric. Try removing them.

You also do not need the brackets around the second Control reference, although this should not affect the validity.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Highlighted
Anonymous
Not applicable

Re: Conditional choices for items in a custom entity.

@WarrenBelz I tried the solution suggested, but that didn't work. I do believe that the Text reference is needed.

Highlighted
Community Champion
Community Champion

Re: Conditional choices for items in a custom entity.

OK @Anonymous ,

I will tag my code guru colleague @Eelman to see if he has any ideas.

Highlighted
Community Champion
Community Champion

Re: How to use multiple Choices Function for the items property for a dropdown/combobox

@WarrenBelz thanks for the tag.

 

@Anonymous have you tried changing your Update property to simply DataCardValue.SelectedItems?

Highlighted
Anonymous
Not applicable

Re: How to use multiple Choices Function for the items property for a dropdown/combobox

Hi Thanks for answering

but i get the error below. 

 

Would you be able to replicate what i am trying to do ?

 

-So basically I have a Edit Form. That has a Field called XXX from CDS entity, which is a dropdown(Optionset). I want that Drop downbox to be able to have a conditional to choice between two set of choices. Choices as in (optionset values). 

 

-So hence i have put  IF(true, choices(1), Choices(2)) in the items property of that field

But then i get an error in the Update property 

 
 

Capture3.PNG

Highlighted
Community Champion
Community Champion

Re: How to use multiple Choices Function for the items property for a dropdown/combobox

@Anonymous  Unfortunately, I can't recreate your situation because I don't have access to CDS. However, OptionSets sounds like Choices in SharePoint, maybe?

 

One thing you could try is building a single table based on both option sets, schema example

 

OptionSet data || fromTable

[...                      || Table1

                  ...].   || Table1

[...                      || Table2
                  ...].   || Table2

 

Then depending on your other dropdown selection, Filter the above table for your records?

 

The other question I have is, what type of field in Update patching back to? If it's  a Choice/Option Set field I'd be pretty certain you can't do what you want here because your trying to change the database schema. However, If it's a simple text Field I think you'd be ok.

 

@PowerAddict  may be able to help here with his CDS knowledge?

 

Highlighted
Super User
Super User

Re: How to use multiple Choices Function for the items property for a dropdown/combobox

Thanks @Eelman.

I have a few questions:
1. How is your field (the one you are trying to update using the edit form) defined in CDS? You can define only one option set when you create a field. So not sure how two option sets can be used to update that field.
2. The Update property has to have an option set value, so you cannot specify two optionset values as the definition of that field was done by just 1 optionset.
3. If you really want 2 different dropdowns to update the XXX field, can you replace that field with a text field? You could then have a conditional in the Items property and use 2 dropdowns populated locally with a collection or a data table.

I can share a working example of point #3 if this is something that will work for you. I can possibly share a few more alternatives but let me know your thoughts.

---
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
Super User
Super User

Re: How to use multiple Choices Function for the items property for a dropdown/combobox

Also just to add to that, if you just want your dropdown values to be different based on certain criteria, you could create just 1 options that has all the values, and then split it into two sub lists based on your criteria. I can give you the details about this approach if you are fine with using just 1 option set.

---
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

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 (9,190)