cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How to set a default value in Options Set to CDS?

Hi everybody!

 

Just got a short question about setting a default value in an Options Set column in a CDS.

You know if you create a field in CDS, you can choose the Data type and I've chosen Option Set - yes and no (boolean) and set the default value to none in the field option.

 

But how to set a default value by adding a record into the CDS? I've tried ColumnName: Blank() - It's being accepted but it's not working the way I like. I'm afraid the default value is set to "Yes" or "No". But I need an empty value in the column.

 

How to achieve this?

 

Thanks so much for helping!

1 ACCEPTED SOLUTION

Accepted Solutions
Drrickryp
Super User II
Super User II

Hi @Anonymous 

If use a two value option set, I don't believe that you can do what you want.  However, if you use a regular option set, and set it to no default value and Required is set to optional, if the user doesn't make a choice in that field, it will be entered as a blank. In the edit form in the app, you can modify the Display name in the card for that field to 

 

Parent.DisplayName & " (Optional)"

 

So that the user knows that a choice is not required.  In the combobox in the card there is a property called no selection text.  You can put a message in there like "none".

Annotation 2020-06-07 100855.jpg

View solution in original post

2 REPLIES 2
Drrickryp
Super User II
Super User II

Hi @Anonymous 

If use a two value option set, I don't believe that you can do what you want.  However, if you use a regular option set, and set it to no default value and Required is set to optional, if the user doesn't make a choice in that field, it will be entered as a blank. In the edit form in the app, you can modify the Display name in the card for that field to 

 

Parent.DisplayName & " (Optional)"

 

So that the user knows that a choice is not required.  In the combobox in the card there is a property called no selection text.  You can put a message in there like "none".

Annotation 2020-06-07 100855.jpg

View solution in original post

Anonymous
Not applicable

Hey @Drrickryp,

 

appreciate your support. Thanks so much.

 

However, if you use a regular option set, and set it to no default value and Required is set to optional, if the user doesn't make a choice in that field, it will be entered as a blank.

Yes, I've tried this as well. Before writing this post, all my code behaves differently and I thought this might not be the solution I'm able to choose.

 

After you've written your reply, I've tried it again and it worked.

 

Thanks so much for helping!

 





Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,741)