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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / CDS Two Options (numbe...
Power Apps
Answered

CDS Two Options (number) - Singe Check Box

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi there,

 

I am creating and app that has an two option field in CDS (the two options are 0 or 1). By default, powerapps shows a dropdown box with the two options. I have figured out how to insert a toggle and i've checked out this answer about inserting 2 checkboxes

https://powerusers.microsoft.com/t5/Building-Power-Apps/How-do-I-make-a-Dropdown-a-checkbox-for-a-Two-Optionset-on-edit/td-p/282271 however i would like to just be able to insert one checkbox - if checked it writes back a 1 to the CDS, if unchecked it writes back a 0. Any ideas?

 

Cheers

Categories:
  • WarrenBelz Profile Picture
    156,926 Most Valuable Professional on at

    Hi @Anonymous ,

    I am not a CDS user, but the below should work.

    If you are using SubmitForm on the Update property of the card
    If (Checkbox.Value=true,1,0)

     

    If Patch

    OnCheck patch the CDS record with 1

    OnUncheck, Patch the CDS record with 0

     

     

    Please click and accept as Solution if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks for your  help @WarrenBelz, but i can't seem to get that to work.  Might need some more detailed explanation or different approach?

     

    Thanks!

  • WarrenBelz Profile Picture
    156,926 Most Valuable Professional on at

    Hi @Anonymous ,

    Just so I make sure I was not ambiguous on this (which is possible):-

    • You have a card with the data source of a numeric field.
    • You have a checkbox in that card (I will call it CheckBox1) that can be checked or not
    • The Update properties of the card is    If (Checkbox.Value=true,1,0)
    • It does not work in CDS

    If this is the case, I will leave it to others who will know CDS better.

    Sorry I could not assist.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thankyou, but i can't get it to work - CDS is weird!

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Solved this myself - thought i'd share the solution:

     

    Change the Checkbox Default to :

    If(

    ThisItem. 'YourEntityName'='YourEntityName (YourDataSourceName)'.'1',

    ThisItem. 'YourEntityName'='YourEntityName (YourDataSourceName)'.'0',

    false)

     

    Note: if your options are numbers, they must be in single quotation marks.

     

    Change the DataCard Update to:

     

    If(CheckBoxName.Value,
    'YourEntityName (YourDataSourceName)'.'1',
    'YourEntityName (YourDataSourceName)'.'0')

  • WarrenBelz Profile Picture
    156,926 Most Valuable Professional on at

    Hi @Anonymous ,

    I am glad you solved it - also glad I am on SharePoint . . .

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard