cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Cym Advocate II
Advocate II

CDS 2 choices field - toggle instead of dropdown datacard

I have a number of 2 choices fields in CDS. I am trying to create a powerapp that has toggles to switch these on and off. PowerApps inserts a dropdown as a default and will not allow me to switch to a toggle. I have deleted the dropdown and inserted a toggle and attempted to change the Update control of the datacard according to the below thread, but it doesn't seem to work. 

https://powerusers.microsoft.com/t5/Building-Power-Apps/CDS-entity-boolean-field-coming-as-dropdown-...

 

The formula i have used in the Update Control is: If (ElectricyToggle.Value=true, 'T5 Electricity'('Take 5S').Yes,'T5 Electricity'('Take 5S').No)

 

Super appreciate any help!  

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Re: CDS 2 choices field - toggle instead of dropdown datacard

Hi @Cym ,

Could you please share a bit more about the "Choice" field in your CDS Entity? Are they both "Two Options" type column?

 

Based on the needs that you mentioned, I think you want to change the default ComboBox to Toggle in your Edit form for the "Two Option" type column, is it true?

 

I have made a test on my side, please consider take a try with the following workaround:

1.JPG

 

2.JPG

Unlock the "Two Option" field data card in your Edit form, then remove the default ComboBox, and insert a Toggle control in it. Set the Update property of the "Two Option" field data card to following:

 

If(Toggle1.Value, 'IsOverdue (TaskLists)'.Yes, 'IsOverdue (TaskLists)'.No)

 

Note: The 'IsOverdue' is a Two Options type column in my CDS Entity.

On your side, you should type:

 

If(
   Toggle1.Value, 
   'TwoOptionFieldName (EntityName)'.Yes, 
   'TwoOptionFieldName (EntityName)'.No
)

 

 

Set the Default property of the Toggle control to following:

 

If(
    ThisItem.IsOverdue = 'IsOverdue (TaskLists)'.Yes,
    true,
    ThisItem.IsOverdue = 'IsOverdue (TaskLists)'.No,
    false
)

 

On your side, you should type:

 

If(
    ThisItem.TwoOptionFieldName = 'TwoOptionFieldName (EntityName)'.Yes,
    true,
    ThisItem.TwoOptionFieldName = 'TwoOptionFieldName (EntityName)'.No,
    false
)

 

 

If the 'Choice' type field that you mentioned is a Option Set type column in your CDS Entity, please modify above formula as below:

Update property of field data card:

 

If(
   Toggle1.Value, 
   [@OptionSetFieldName].Yes, 
   [@OptionSetFieldName].No
)

 

 Default property of Toggle control:

 

If(
    ThisItem.TwoOptionFieldName = [@OptionSetFieldName].Yes,
    true,
    ThisItem.TwoOptionFieldName = [@OptionSetFieldName].No,
    false
)

 

Please consider take a try with above solution, then check if the issue is solved.

 

In addition, please check if you have reference proper 'Two Option' column value within your If formula. Please consider modify your formula as below:

 

If(
   ElectricyToggle.Value, 
   'T5 Electricity (Take 5S)'.Yes,  // Modify formuila here. Wrappd with single quote
   'T5 Electricity (Take 5S)'.No    // Modify formuila here. Wrappd with single quote
)

 

3.JPG

 

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

13 REPLIES 13
Super User
Super User

Re: CDS 2 choices field - toggle instead of dropdown datacard

Hi @Cym 

Please check out the post https://powerusers.microsoft.com/t5/Building-Power-Apps/Use-a-toggle-to-change-a-field/m-p/169030#M5... .  I think it shows how to do it.

Cym Advocate II
Advocate II

Re: CDS 2 choices field - toggle instead of dropdown datacard

Thanks again @Drrickryp,  but that doesn't seem to work for data located in a CDS.  Anyone got any other ideas?

 

C

Community Support
Community Support

Re: CDS 2 choices field - toggle instead of dropdown datacard

Hi @Cym ,

Could you please share a bit more about the "Choice" field in your CDS Entity? Are they both "Two Options" type column?

 

Based on the needs that you mentioned, I think you want to change the default ComboBox to Toggle in your Edit form for the "Two Option" type column, is it true?

 

I have made a test on my side, please consider take a try with the following workaround:

1.JPG

 

2.JPG

Unlock the "Two Option" field data card in your Edit form, then remove the default ComboBox, and insert a Toggle control in it. Set the Update property of the "Two Option" field data card to following:

 

If(Toggle1.Value, 'IsOverdue (TaskLists)'.Yes, 'IsOverdue (TaskLists)'.No)

 

Note: The 'IsOverdue' is a Two Options type column in my CDS Entity.

On your side, you should type:

 

If(
   Toggle1.Value, 
   'TwoOptionFieldName (EntityName)'.Yes, 
   'TwoOptionFieldName (EntityName)'.No
)

 

 

Set the Default property of the Toggle control to following:

 

If(
    ThisItem.IsOverdue = 'IsOverdue (TaskLists)'.Yes,
    true,
    ThisItem.IsOverdue = 'IsOverdue (TaskLists)'.No,
    false
)

 

On your side, you should type:

 

If(
    ThisItem.TwoOptionFieldName = 'TwoOptionFieldName (EntityName)'.Yes,
    true,
    ThisItem.TwoOptionFieldName = 'TwoOptionFieldName (EntityName)'.No,
    false
)

 

 

If the 'Choice' type field that you mentioned is a Option Set type column in your CDS Entity, please modify above formula as below:

Update property of field data card:

 

If(
   Toggle1.Value, 
   [@OptionSetFieldName].Yes, 
   [@OptionSetFieldName].No
)

 

 Default property of Toggle control:

 

If(
    ThisItem.TwoOptionFieldName = [@OptionSetFieldName].Yes,
    true,
    ThisItem.TwoOptionFieldName = [@OptionSetFieldName].No,
    false
)

 

Please consider take a try with above solution, then check if the issue is solved.

 

In addition, please check if you have reference proper 'Two Option' column value within your If formula. Please consider modify your formula as below:

 

If(
   ElectricyToggle.Value, 
   'T5 Electricity (Take 5S)'.Yes,  // Modify formuila here. Wrappd with single quote
   'T5 Electricity (Take 5S)'.No    // Modify formuila here. Wrappd with single quote
)

 

3.JPG

 

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Cym Advocate II
Advocate II

Re: CDS 2 choices field - toggle instead of dropdown datacard

Hi @v-xida-msft you are correct -the Choice field is Two Options in the CDS (see attached snip). Your solution looks promising!  I'll give it a crack and let you know if it works. Thanks for your help 🙂

 

 
Community Support
Community Support

Re: CDS 2 choices field - toggle instead of dropdown datacard

Hi @Cym ,

Yeah, I think there is something wrong with the 'Two Option' column value reference in your If formula. Please modify it as I mentioned above, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Cym Advocate II
Advocate II

Re: CDS 2 choices field - toggle instead of dropdown datacard

hi @v-xida-msft  - i've put in the formula in to the update section exactly as you have described, but i'm still getting an error (see below)

Community Support
Community Support

Re: CDS 2 choices field - toggle instead of dropdown datacard

Hi @Cym ,

There are some updates within my first reply. On your side, you should type following formula:

If(
   ElectricyToggle.Value, 
   'T5 Electricity (Take 5S)'.Yes,  // Modify formuila here. Wrappd with single quote
   'T5 Electricity (Take 5S)'.No    // Modify formuila here. Wrappd with single quote
)

 

Best regards, 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cym Advocate II
Advocate II

Re: CDS 2 choices field - toggle instead of dropdown datacard

Sorry @v-xida-msft for being a bit dumb, but not quite sure what you mean by the modification? Do you mean this?  If so, it also doesn't seem to work.

 

 

Community Support
Community Support

Re: CDS 2 choices field - toggle instead of dropdown datacard

Hi @Cym ,

Based on the screenshot that you provided, I think there is something syntax error with it:

4.JPG

There should be a space between the field name and the Entity name. Please modify it within your formula.

 

If(
   ElectricyToggle.Value, 
   'T5 Electricity (Take 5S)'.Yes,  // Modify formuila here. Wrappd with single quote
   'T5 Electricity (Take 5S)'.No    // Modify formuila here. Wrappd with single quote
)

Note: There should have a space after 'Is Electricity, before (Take 5S)'.No.

4.JPG

 

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ T-Shirt Contest – Winner Announced!

‘Better Together’ T-Shirt Contest – Winner Announced!

And the winner is...

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Power Platform 2020 release wave 1 plan

Power Platform 2020 release wave 1 plan

Features releasing from April 2020 through September 2020

Users online (5,884)