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 / How to get Yes/No valu...
Power Apps
Unanswered

How to get Yes/No value and put it to my variable?

(0) ShareShare
ReportReport
Posted on by 264

Hello, guys!

Canvas App-> Dataverse Table-> Edit Form

 

I use Data Cards to edit a record.

I need to set field value with a button. Field DataType is "Yes/No"

 

I mean:

Button1.Click - It sets Yes to the Field. Button2.Click - it sets No.

But I didn't find the way how to get Choice value and set it to my variable correctly.

 

I believe there is a way something like this:

  Set(varYes, [@YesNo].Yes);

 

Of course it works this way

 Set(VarYes: First(Choices('QC (Work Orders)')).Value);

 Set(VarNo: Last(Choices('QC (Work Orders)')).Value);

Where 'QC (Work Orders)' is field QC in table Work Orders.

 

But it is not a correct solution of the issue.

Do you know how to get Yes/No value?

 

 

I have the same question (0)
  • v-yueyun-msft Profile Picture
    on at

    Hi , @Max77 

    According to your description, do you mean you want to use a button to get the true and false.

    If this , you can try to use :

    Set(varFalg,!varFalg)

     

     

     

    If I misunderstand what you mean, you can describe your needs and your expected outcomes in detail so that we can better help you.


    Best Regards,

    Yueyun Zhang

     

     

  • Max77 Profile Picture
    264 on at

    @v-yueyun-msft , I'll try to simplify my question.

    Here you can see DataCard and its property Update.

    Max77_0-1702543778671.png

     

    I need to put static Value in the Property

    someting like this

    Max77_1-1702543992501.png

    true, false, 0, 1 don't work with this property.

     

    Record doesn't work either

    Max77_2-1702544117204.png

     

    But this way works. No error. So I need the corrrect method to get Yes or No value.

    Max77_3-1702544376918.png

     

     

  • v-yueyun-msft Profile Picture
    on at

    Hi , @Max77 

    I test it in my side . We can just use the "First( Choices('YesOrNo (YesNoTables)'))"  to update the Yes and No column, we can not use the custom record here .

    Here , i create a toggle to control Yes and No:

    vyueyunmsft_0-1702546218661.png

     

    And for the DataCard-Update, we can not use the record here , we need to use the default code :

    vyueyunmsft_1-1702546277833.png

    And if you want to use the toggle to control Yes and No in this Combo box , we can use this code in the Combo Box - DefaultSelectedItems:

    vyueyunmsft_2-1702546379038.png

    [If(Toggle1.Value=true , First( Choices('YesOrNo (YesNoTables)')) , Last( Choices('YesOrNo (YesNoTables)')) )]

     

    And also we can use the SubmitForm(Form) action to update the datasource.

     

    Best Regards,

    Yueyun Zhang

     

  • Max77 Profile Picture
    264 on at

    @v-yueyun-msft 

     

     

    [If(Toggle1.Value=true , First( Choices('YesOrNo (YesNoTables)')) , Last( Choices('YesOrNo (YesNoTables)')) )]

     

     

    It's the same solution as I used

     

     

    First(Choices('QC (Work Orders)')).Value

     

     

    But I can't uderstand why your solution works without 

     

     

    .Value

     

     

     

    Anyway, It's not stable solution. 

    Look, this is in design mode

    Max77_0-1702561097097.png

     

    and this is in Product mode (after I published my canvas page and started the app)

    Max77_1-1702561249650.png

     

    So the first Record isnt a Constanta.

    Our company registered in Canada and i work remoutely from Ukraine.

     

     

    PS: I spent all the day for this simple task and can't find a solution. What does Microsoft think? Perhaps PowerApps is intended for kids and I'm trying to build a serious application based on it.

  • Max77 Profile Picture
    264 on at

    As I understand there is no way to get these values correctly.

     

     

     

     

    UpdateContext(
     {
     BoolVar1: First(Choices('YesOrNo (YesNoTables)')).Value,
     BoolVar2: Last(Choices('YesOrNo (YesNoTables)')).Value
     }
    );
    If(
     Text(BoolVar1) = "Yes",
     Set(
     ConstYes,
     BoolVar1
     ),
     Set(
     ConstNo,
     BoolVar1
     )
    );
    If(
     Text(BoolVar2) = "Yes",
     Set(
     ConstYes,
     BoolVar2
     ),
     Set(
     ConstNo,
     BoolVar2
     )
    );

     

     

     

     

    of course this works only for English.

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard