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

Community site session details

Session Id : VV4XM2i5etnWDYC2pju6R8
Power Apps - Microsoft Dataverse
Unanswered

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

Like (0) ShareShare
ReportReport
Posted on 13 Dec 2023 15:11:03 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?

 

 

Categories:
I have the same question (0)
  • Max77 Profile Picture
    264 on 18 Dec 2023 at 17:24:11
    Re: How to get Yes/No value and put it to my variable?

    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.

  • Max77 Profile Picture
    264 on 14 Dec 2023 at 13:41:48
    Re: How to get Yes/No value and put it to my variable?

    @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.

  • v-yueyun-msft Profile Picture
    on 14 Dec 2023 at 09:33:36
    Re: How to get Yes/No value and put it to my variable?

    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 14 Dec 2023 at 09:01:44
    Re: How to get Yes/No value and put it to my variable?

    @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 14 Dec 2023 at 01:38:54
    Re: How to get Yes/No value and put it to my variable?

    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

     

     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 892 Most Valuable Professional

#2
Power Apps 1919 Profile Picture

Power Apps 1919 356

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 310 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Loading complete