cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MariusSolend
Regular Visitor

Error/Bug with control of type TwoOptions with usage "bound"

I think there is a bug in the function ParseRaw in the SimpleFormatter.ts file which is a part of the framework.

When i use TwoOptions my value type is boolean.

If my value is false, it will return on line 4.

If my value is true, it will step into the ManifestType.TwoOptions case and result in the following error:

"e.toLowerCase is not a function"

Because "toLowerCase" does not exist on a boolean value.

Im i doing something wrong here? My ManifestTypes.d.ts file generates boolean values for my TwoOptions control.

 

export function ParseRaw(value: string, type: string): any {
    let valueRaw: any;

    if (!value) {
        return value;
    }

    switch (type) {
        case ManifestType.Decimal:
        case ManifestType.FP:
        case ManifestType.Currency:
            valueRaw = isNaN(parseFloat(value)) ? undefined : parseFloat(value);
            break;
        case ManifestType.OptionSet:
        case ManifestType.WholeNone:
            valueRaw = isNaN(parseInt(value, 10)) ? undefined : parseInt(value, 10);
            break;
        case ManifestType.DateAndTimeDateAndTime:
        case ManifestType.DateAndTimeDateOnly:
            valueRaw = new Date(value);
            if (isNaN(valueRaw)) {
                valueRaw = undefined;
            }
            break;
        case ManifestType.TwoOptions:
            valueRaw = value.toLowerCase() === 'true' ? true : false;
            break;
        default:
            valueRaw = value;
    }

    return valueRaw;
}
3 REPLIES 3
jolake
Power Apps
Power Apps

Providing a boolean is correct. This appears to be an error in our tooling only, you should see no issues with this control in an actual application.

We will file an internal bug to have the tooling system updated appropriately. Apologies for this inconvenience.

Thanks for the reply 🙂

 

So this will only happen when i run it in the localhost debugger and not when i host the control in D365?

 

Regards.

 

Marius

Hi Marius,

This is correct. The code you've pointed out is specific to the testing harness, and doesn't exist in production code.

-John

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Users online (2,315)