cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Dlabar
Level 8

Unable To Build A Canvas App Component For Yes/No/Null CDS Option Set

I wanted to create my own component that was two buttons that allowed for updating a CDS global option set attribute.  When I defined the component, I defined the outputed selected value property to be a number, but there appears to be no methodology to map from the number to the option set attribute without handling each value specifically in a set of if/choice statements.  I had originally designed the component to be flexible, and work for any option set, even ones with multiple values, but since I can't map from the number to the OptionSet I thought about trying to take a dependency on the OptionSet, but I can't define the component output property to be of type OptionSetValue.

 

My only option I can see now is to create an input table with a record that has each value selected, and each of these Option Set Values are used to display the text on the button, and then there is an output record that is the selected record for the button.  Anyone have a better idea? 

2 REPLIES 2
Community Support Team
Community Support Team

Re: Unable To Build A Canvas App Component For Yes/No/Null CDS Option Set

Hi @Dlabar ,

Do you want to use component to update an option set field?

Firstly, it's not supported to define Action in component currently.

This function will be coming:

https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Actions-on-Components/idi-p/238399

So, as an alternative way, I suggest you add a confirm button to submit.

I've made a similar test for your reference:

1)my field:

12102.PNG

 2)in my component, insert two buttons, one for "yes", one for "no"

set yes button's OnSelect:

Set(buttonvalue,true)

set no button's OnSelect:

Set(buttonvalue,false)

add a new custom property:

12103.PNG

 3)set the component's value: buttonvalue

12104.PNG

 

4)in the app, insert the component, insert a confirm button

set the confirm button's OnSelect:

If(Component1_1.value,Patch(testmanies,Defaults(testmanies),{Name:"test",test1210:'A Yes or No boolean'.Allowed}),Patch(testmanies,Defaults(testmanies),{Name:"test",test1210:'A Yes or No boolean'.'Not Allowed'}))

12105.PNG

 

Then after you click the "yes/no" button, click confirm button, the option set field will be updated.

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Dlabar
Level 8

Re: Unable To Build A Canvas App Component For Yes/No/Null CDS Option Set

That is a good work around, but it still requires a mapping function to map the value from the component to the OptionSetValue.  What if I wanted to do it for the 50 states?  That would require 50 manual assignments from the component value, to the Option Set Value, which is what I'm trying to avoid.

Helpful resources

Announcements
thirdimage

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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (4,346)