Multi select options

Within the CDS we have a drop down option available. As we saw in Entities in the CDS we can create fields of all sorts of types, one being the Option Set.

Drop Downs in SharePoint

If you come from a SharePoint background like me you will know how often you need to choose between choice lists, lookup lists and managed metadata fields. They are 3 ways to feed a drop down in a SharePoint list.

Today in my series of posts about the CDS, I’m looking at option sets.

To Create an option set field in an entity you simply need to select Option Set or Multi Select Option Set and then there is of course the Two options and Lookup to consider as well.

Create Option Set field

Two Options

First I’m selecting the Two Options for a field called Left Hand Drive.

Two Options

Although this is not an option set it does help me introduce the set of options field types available in the CDS.

Similar to the Two options I can also create the fields using the Option Set as a data type and then oneof the available options is a Yes or No boolean. Similarly I could also create a new option set and add a Yes or No as the options available. Before you know it you will have 20 yes/no option sets.

OptionSets

I hope that it is clear that you should want to reuse what is there. Rather than just creating new option sets for every drop down that you can think of.

Custom Option Sets

Now that we know that we should first check if an option set already exists, we can look at creating new ones. I want to create an option set for Colour and I can do this by selecting the +New option set.

Option set used for colours

You can now add all the items in your choice list. In my case I’m going to add 5 options. Don’t worry too much about getting all the options, you can always add more later.

Adding colours

Within the Option Sets overview you can now find the option set that you created back. It is easy to find the ones that you created by checking the Type column. The custom ones are marked as Custom.

Option Set overview

Multi Select Option Sets

Cool car

In my above example I considered how to create an option set for the colour of my cars. Stupid me, I didn’t consider multi coloured cars. Do I now have to recreate my option set?

No!

You can simply create a new field ( I’m calling it colours) and after selecting Multi Select Option Set and I can now reuse my Colour option set that I created earlier

Colours Option Set

Other interesting posts about CDS

Common Data Service – a complete overview

By Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using contact@veenstra.me.uk.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: