cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Cym
Level: Powered On

CDS Two Options (number) - Singe Check Box

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

1 ACCEPTED SOLUTION

Accepted Solutions
Cym
Level: Powered On

Re: CDS Two Options (number) - Singe Check Box

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')

View solution in original post

6 REPLIES 6
WarrenBelz
Level 8

Re: CDS Two Options (number) - Singe Check Box

Hi @Cym ,

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.

Cym
Level: Powered On

Re: CDS Two Options (number) - Singe Check Box

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
Level 8

Re: CDS Two Options (number) - Singe Check Box

Hi @Cym ,

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.

Cym
Level: Powered On

Re: CDS Two Options (number) - Singe Check Box

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

Cym
Level: Powered On

Re: CDS Two Options (number) - Singe Check Box

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')

View solution in original post

WarrenBelz
Level 8

Re: CDS Two Options (number) - Singe Check Box

Hi @Cym ,

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

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,340)