Announcements
I may have found a bug with pcf when it comes to TwoOptionsThe documentation states that This column provides two options. Each option has a number value of 0 or 1 corresponding to a false or true value. Each option also has a label so that true or false values can be represented as "Yes" and "No", "Hot" and "Cold", "On" and "Off" or any pair of labels you want to display.https://docs.microsoft.com/en-us/powerapps/developer/component-framework/manifest-schema-reference/property#remarksBut in the SimpleFormatter.js file, we have this code segment. Since the value is not string, .toLowerCase() would result to a type error.
Meh. I mean, it is in an Else branch where the main branch checks typeof == "boolean"
Would an actual boolean fail to go to lower case? Yes. But would an actual boolean ever hit that branch? Nope.
So, not really a bug, I think. Maybe just a piece that was intended to support more flexible inclusions like the string label not yet parsed to boolean. Nothing wrong with that. Your code doesn't break on it, right?
cchannon,If you look at the screen shot the value is a number. And the "meh" results to the sandbox "crashing" to a blank screen. It doesn't even load my control. So I still think it's a bug.
huh. OK, well I didn't expect it to actually get a numerical; figured it would be bool or string or nothing.
But, you don't really need it anyway. Not sure why they even included it other than a dev sitting around going, "...but I mean, I guess we kinda have to have a boolean type, right?" You can just use Enum with only two options. Then you'll have no cast issues; it will simply give you 0 or 1 (or whatever numbers you assign).
Hi @rexkenley ,
the param .raw is a boolean for a TwoOptions parameter. I guess the docs are referring to the Options that you get, when you consider the param.attributes.Options, which is an array with {Label, Value, Color}. The description is similar to OptionSets too: in that case the value is a number.
Regarding the crash in the harness, I don't know how you made it to introduce an integer. The harness is providing a "Select" where you can choose the options True/False. This will pass a boolean to the control.
Did you maybe change the type of the parameter ?In case you set the value to a number, and that broke the harness, there is a workarround for that. Search in the localStorage for http://127.0.0.0:<yourPort> the key <controlName>_properties. There are saved the value for the harness. If you delete that, the harness should be refreshed, and you can start again. In my older blog (the bottom part, about the broken harness ) I have a few details on this: https://dianabirkelbach.wordpress.com/2020/03/22/colorful-optionset-part1/
Hope this helps!
Kind regards,
Diana
@DianaBirkelbach
Thanks! Clearing the cache works.Although I wonder if this could be considered a "code design bug" considering that both JS and SQL consider 0 to be false. The key value to the "true" option is 0. So you can't use the key value without inverting it, unlike the other types of options where you can use the key values directly.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our 2026 Super Users!
Congratulations to our 2025 community superstars!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Vish WR 1,045
Valantis 675
11manish 592