web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / What column type to us...
Power Apps
Unanswered

What column type to use as boolean supported by Power Apps

(0) ShareShare
ReportReport
Posted on by 107

I am trying to create a custom column in Dataverse to store a boolean value. I'm making a power app which pulls the value from Dataverse to set the position of a toggle (all good so far), then I'd like another control to be able to change the value of the toggle (this is where it breaks). This is the logic I have so far:

 

PowerApp page:

OnVisible = Set(varBooleanTest, selectedProfile.Selected.'booleanTest')

*Note, "selectedProfile" is a dropdown which is connected to the dataverse table with the boolean value. The column booleanTest is a Yes/No column 

 

toggle_1:

Default = varBooleanTest

 

Now when I open the page, the toggle is set to the value from the table which is selected in the dropdown - all good so far. I then add another toggle which has overarching control in my context. The functionality I want is when the toggle is switched off, it also turns off the toggles under it, including toggle_1. So, what I've tried is:

 

toggle_2:

OnUnCheck = set(varBooleanTest,false)

 

And here is where I get my error:

lachlanP_0-1635953930828.png

 

Now when I back up to the OnVisible formula, I can see that it no longer likes how the data was brought in. It looks like it cant detect the data type as boolean.

lachlanP_1-1635954100399.png

More proof to that theory:

lachlanP_2-1635954185152.png

 

So my question is, is there a column type I can use in DV which PowerApps recognizes as boolean? Here is what I've tried with no success:

 

  • Using a yes/no column with the items set to "true" and "false" lachlanP_3-1635954290586.png

     

  • Using a yes/no column with different string values, then assigning them to boolean in PowerApps:
    • Data type - Yes/No
    • Items - Enabled, Disabled
    • In PowerApps OnVisible = Set(varBooleanTest, If(selectedProfile.Selected.booleanTest = 'enabled',true,false));
    • This fails as selectedProfile.Selected.booleanTest is not a recognised data type able to be evaluated
  • I've tried the same method as above with both "Choice" and "Choices" column types, trying to switch a string value to boolean in PowerApps and get the same error

 

Hopefully this is possible as it seems like pretty simple functionality to be able to pass a boolean column type to PowerApps!

 

Thanks in advance for the help.

I have the same question (0)
  • Verified answer
    Drew Poggemann Profile Picture
    9,287 Most Valuable Professional on at

    Hi @lachlanP ,

     

    Take a look at this article, I think it will help you with your situation on the form...  I have used in the past as well.

    https://thepoweraddict.com/y-yes-no-data-card-in-power-apps-for-better-ux/ 

     

    Hope this helps.  Please accept if answers your question or Like if helps in any way.


    Thanks,

    Drew

  • v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @lachlanP,

    Do you want to transfer boolean value from Dataverse Yes/No column to Power Apps?

    Could you please share  a bit more about your scenario?

     

    Actually, you are right that there is no way to transfer boolean value from Yes/No column in Dataverse to Power Apps.

    You should know that selectedProfile.Selected.'booleanTest' always returns a text value instead of a boolean value which explains why the data type incompatible when you set the variable on the OnUncheck property of the Toggle.

     

    In addition, the Toggle control has its own Default property, which is usually false. So if you set the variable in the OnUncheck property, it will cause an error like invoke issue. The OnUncheck property of the Toggle may not trigger the variable even though it is unchecked because it has false as its Default property value.

     

    As an alternative solution, I think a Text column in Dataverse table would be a better choice.

    You could set the toggle_2 OnSelect property as below:

    Set(varboolean,Toggle_2.Value)

    Set the toggle_1 Default property as below:

    If(varboolean=false,false)

     

    To save the value to your Text column, just need to refer to the Toggle.Value.

    Hope this could help you at some degree.

     

     

  • lachlanP Profile Picture
    107 on at

    @v-qiaqi-msft ,

     

    Yes, what I am trying to do is transfer a boolean value from Dataverse to Power Apps (using whatever column type I can). 

     

    You stated that selectedProfile.Selected.'booleanTest' will always return a text value from a yes/no column in Dataverse, but then why doesnt it work to convert this to a boolean in Power Apps using:

    set(varBooleanTest, if(selectedProfile.Selected.'booleanTest' = "yes", true, false))

     

    Instead I get an error on the "=" character stating that the evaluation is of incompatible types. It seems that the type for a yes/no column is useable in some cases, but not recognized in others. 

     

    I arrived at the same conclusion that the best work-around is to use a true text column in Dataverse, then I am converting to boolean in Power Apps using the method above. The problem with this is the functionality loss in Dataverse - I now have an uncontrolled text column which is prone to error rather than a simple boolean column. 

     

    I found this idea posted already with unfortunately no votes, it seems to be referring to the same issue I am dealing with (the fact that there is not a true boolean column type in dataverse):

    https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Add-quot-real-quot-boolean-field-type-to-Dataverse-CDS/idi-p/1314589

  • Verified answer
    lachlanP Profile Picture
    107 on at

    @dpoggemann 

     

    This post was the ticket! Thank you!

     

    The key was how I evaluated the yes/no column from dataverse. Where I tried to compare to either a boolean value or a text value, it works when formatted as below:

    Set(varBooleanTest, If(selectedProfile.Selected.booleanTest = 'booleanTest (IoT Device Profiles)'.Yes, true, false));

     

    Where (IoT Device Profiles) is the name of the Dataverse table. Now when I use above as the OnVisible formula, it basically converts this value to boolean.

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.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard