As part of my Common Data Service series I introduced entities in the first part of this post. Time to get on with creating an Entity. In this post I will create an entity for Cars.  The New Entity form will ask me for the singular and the plural name for the entity.

Fields

Car Entity in CDS

I’m also supplying the primary field for the cars. I’m choosing the use the number plate as a unique primary field.

Once the entity has been created I can now add more fields to my entity.

Add more fields to an Entity in the Common Data Service

I could now choose to add a field called brand where you can register the brand of the car. This could be a simple text field. But I could also choose to use an option set. that then gives the user the option to select the brand of the car from a pre-populated drop down list.

Create a new field called Brand

Ok, there are choices to be made. Like mentioned before you want to make sure that you make the right choices. With some many data types available in can be difficult to get it right.

Datatypes

But that is not all.

You can also create calculated fields or Rollup fields. Rollup fields can be used to collect information across relation ships on entities. So for example if there was a relation ship between people and cars called drivers. Then you could calculate the total age of all drivers.

Advanced options

Relationships

Once you have added all your fields to an entity you might find that you want to create relation ships between entities.

Add Relationship

With relation ships you can specify how one identity relates to another. There are 3 different types of relationships possible.

  • Many to one
  • One to many
  • Many to many

3 Relationships

When we look at the drivers relation ship mentioned before you will have to make a data design choice here.

  • Can you have more than one driver for one car?
  • Can you drive in more than one car?

The difficulty here can be that when you design your data you are sure that a relation ships of one type and then later on you decide that you may need a different type of relationship. In my case I’m going for the One-to-Many relationship. I will have one car with multiple drivers.

Business Rules, Views, Forms, Dashboard and charts

Related to your entity you can specify business rules, views, forms, dashboards and charts. This becomes important as you look at Model driven apps. So far all I’ve looked at in these posts is related to canvas apps and flows. I will look at business rules, views and forms in my post about Model driven apps and flows.

Keys

As always with relational databases keys are key in your database design. Within the Key configuration section of my entities I can specify which fields make up the key.

Key

 

More information on CDS

Common Data Service – a complete overview

 

Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications Microsoft MVP working as a Principal Architect at HybrIT Services Ltd. You can contact me using contact@sharepains.com

Leave a Reply

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

Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe now to keep reading and get access to the full archive.

Continue Reading

%d bloggers like this: