A Beginner's Guide to using the Common Data Service with Microsoft Power Apps

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
if you're anything like me you've probably been holding off taking a good look at the common data service you could be forgiven for that because up until this point you haven't really needed the common data service to build applications in powerapp microsoft is rolling out some fantastic features in cds and you can use those and leverage those features in your own power apps the thing is you're kind of selling yourself short if you don't take a look at the cds and what it has to offer for your power apps development in this episode we're going to take a beginner's look on how you can use the cds in your powerapps application and leverage some of those awesome features before we dive in i just like to say a quick sorry to microsoft for taking so long to take a look at the common data service it has really been an eye-opener apology accepted dear boy okay let's jump right into today's video so i've got make.powerapps.com website open and this is the powerapps development environment that we're all familiar with at this point on the left hand side we've got all of our usual menus and the one we're actually interested in today is the data menu now this is where we access the cds and configure our tables and everything else that we need to build um cds we'll build powerapps and that will use cds entities now i'm doing like little finger quotes at the moment you can't see them but um powerapps just to touch on this quickly powerapps calls the um effectively what we know as tables or i guess records or even sort of more familiar in you know more familiar sharepoint lists this um in power in in the cds they're actually called entities now if you're sort of familiar with the database stuff even though we call them tables and sql we also sort of refer to them as entities especially when we're doing things like entity diagrams but again we don't really need to worry about any of this stuff we just need to know that entities in cds are actually tables or lists and we can use entities where we can create our own entities for our powerapps applications which we can then share across multiple powerapps applications and of course save data and load that data out of exactly how what we do with sharepoint now we're only going to really be delving into that sort of side of things in this particular video because um i really just want to give you a beginners sort of look into this but one thing to note that um with the cds we get a whole ton of more features that we don't get with uh sharepoint lists and um you know can be a little bit clunky as well with using things like sql data are actually pretty easy to do in cds and as you start using cds more you will realize that this is just this stuff is just really designed to build up the round and that's sort of microsoft how mark's up to built built it and just everything that you've been wanting out of a data model you're gonna get out of the cds which is really really good okay so let's dive right in if we expand data and we take a look here like i mentioned right off the top of this menu we can see entities now that's what we're really interested in um we've got a whole heap of other menus here but we're not going to take a look at any of that because we really don't need them at this point all we need is entities so let's click on that and this is really just a default installation i didn't create any of these so um this is what you'll probably be looking at in your when you first generate or when you first go into the cds unless of course you're working in a company that people are already building applications in the common data service but if not you you'll probably have something like this straight out of the box now you can pretty much ignore all of this they're just default entities that microsoft are giving you um you know because it feels like you might need them all like you know it's a standard group of entities that a company may or may not use uh each one of these and like i said these aren't each one of these entities is effectively a table or a list and in there you're expected to store data in regard you know around whatever entity it is for example email or maybe email's not such a good one but organization um phone call position privilege uh yeah so anyway we can just ignore all of that because today's video we're really going to focus on building our own entity and showing you how to sort of interface in with that so this part's really really easy all we need to do is just click on new entity and in here this little box pops out and we've got a display name we've got the plural display name and then what happens here microsoft basically generates its a name a unique name based off that and um then we've got the primary name field and so this primary name field is effectively like you know your primary key it's something that will just be default created in your list and um something you can you you don't need to in even use when you're building your application but you know as an old-school database sharepoint list guy i usually like using my own uh id field that um just has so let's just create a new entity and let's call this so let's create a list around um call it team leave and what we're just going to use this for is to um so the team members can log their their on leave time so if they've got some holidays planned or whatever they can just put an entry into the app which will save this into our our entity or our list that we're creating now um one little gotcha before we move on notice here that when i type leave what power ups or sorry what the cds tries to do here it actually like just pluralized and i'm not sure exactly what does this but this caught me out actually so if i say put something like chino entity see what happens here it pluralizes then it gets it right like it it changes chino entity to chino entities and when i first created one of these i went looking for chino entity and all i could see was chino entities in the available entities list so this is something to to pay attention to so anyway i'm going to call this team leave and i'll just make the plural name the same as the display name you can see here the name the unique name is called crd 96 underscore so that's just like the system name we don't need to worry about that and in here it's created a field uh primary name field and we can just leave that as name why not uh we don't want attachments for this particular list but you could actually add the functionality to save attachments to it as well but let's leave that under more settings we've got some other stuff here that we can set up but we don't really want them right now we don't we're not concerned because what we're doing now is going to be more than enough for what we need for our application so let's just click done now you can see we've come back to our uh entity screen here or our creation screen but up here we've got like a little highlighted area that's saying provision your and provisioning your entity in the background you may continue making changes so like this is happily spinning this entity up in the background so we might just wait until that is done um hopefully that won't take too long there we go your entity team lim has been provisioned successfully awesome all right so we can see here all the fields we're looking at team leave which is the list or the entity i just created but like i said think of this as a sharepoint list when you create a sharepoint list or a custom list in sharepoint and you might just say i just want the default title field and you don't create any other fields you still get a few other fields when you do that things like modified modified by and created and created by so this is the same thing that's happening here sharepoint has sharepoint creates those columns for you and so does cds so it gives you a whole heap of default columns that you may or may not need in your entity now some of these are quite useful some of them we probably won't need right now like status reason um time zone rule version number uh these these columns we just won't use so we can just ignore them but columns like modified on modified by uh created on created by we may very well use and will be useful because they'll just be automatically populated when we create a record which is exactly how it works in sharepoint fantastic exactly what we're after so there are all the fields these sub menus here we can see these are all the fields we've got if we want more fields we can create them here which we probably will in a second um but if i just quickly move across i'll well i can go through what other sort of configurations we can do to this particular entity but under here we can define relationships so um if you're a database guy and you you work with sort of data models and building databases up or as an application developer you may also delve into building your sort of data model on your and your tables that support your application i know i have had to do that on many occasions like write stored procs and that kind of stuff so i need to understand how the data hull hangs together a lot of the time you don't want to just build flat big long big flat tables you want to build sort of relational databases and in here we can define we can do exactly the same thing we can define our this how this entity relates to other entities and in particular how fear how fields within this entity will relate to other entities and that's done through just like with um you know sql tables can't do this so much in sharepoint lists so this is one thing that definitely elevates the cds over using sharepoint lists and gives you a lot more features as far as creating sort of relational databases and relational table and relational tables and data that um that relates to each other um so and we do that through lookup columns as well inside of our entity so yeah that's a really good uh way to do that like on its own sort of screen to configure that up today we're not really going to worry about that so much but again pretty easy so feel free to dive in and play around with that next one is business rules so business rules is really cool as well like most of the time when you're creating sort of sharepoint lists uh when you're sort of when you're generating it when you're creating a sharepoint list for an application or like a power up or or like you're creating a sql table uh for for a power app again um let's sort of talk powerapp um terms here that uh most of time you will roll nearly always you will roll those business rules inside of your application things like you know when this field is blank this field must be blank or when this field equals this value that field must also be equal that value or you know those kind of rules we'll sort of roll that inside of our application now in this in the cds this actually allows us to define business rules at our data model level so um this is really good for a sort of keeping [Music] a more strict control of what data goes into your database and um you know that whole rule of junk in junk out this will help you maintain a healthy set of data inside of your database so yeah by defining rules at the database level you you're effectively stopping sort of other like people circumventing your app and inserting rule or sorry inserting data into your table or making changes to your data that aren't really valid from a business point of view so again that's really all i'm going to say on that feel free to do your own research take a look further into business rules problem maybe something if this video is really successful and people are really interested in cds probably something i will dive in on a future video but definitely feel free to take a look and play around with that pretty simple to set those rules up now views on the other hand we're definitely going to take a look at today so views uh i see is really just a 101 thing as far as uh working with the cds and working with entities this will allow us just in a very similar sort of way that we do with um sharepoint and with sql we can define rules at our table level sorry we can define views at our table level where what what we're doing is we can define filters and sort of um you know column what we want to see as far as what columns are displayed and what data is displayed we can define that at our at our entity level and unlike with sharepoint lists we can't actually with sharepoint lists we can't uh actually access those views from powerapps so we have to do all those sort of filters and logic to filter say gallery for example we have to do that in in power in powerapps and you've probably done that hundreds of times with working with powerapps so you know exactly what i mean but here with the cds we can define those views at the cds level at the entity level so now we can define a whole set of rules and all we do then is just we call that view when we're when we're accessing our data you know when we're configuring our gallery or configuring our data connection in powerapps so um yeah this is it's a far more elegant solution than you know i've always been a fan of trying to take as much logic out of the application as possible so when i build power apps or applications that use a sql back-end i always try to use as much sort of sql logic as i can so i always go for building stored procs whenever i can or or using sql views whenever i can rather than sort of filtering at an application level so this this is where this idea comes in we're going to define these views and define these slices of our data in our entity rather than at our application level and that way they're reusable as well which is fantastic you know really great way to to build an application and um a really sort of a good approach for application development makes a lot of sense anyway moving on so the next uh options here we don't well the next four we don't really use um building sort of standard power apps these are more for model driven apps we don't um we don't really use these when we're just building standard sort of canvas powerapps so therefore they're not really something that i've delved into or used much but again if we're building applications using the using model driven apps this is where we're defining our model um how our model is rendered inside of our application where our forms and our dashboards our charts etc keys again keys is something sort of like this primary key definition but again not really something that's very useful just in canvas apps and not something that you would use so much in your in your application but that said um feel free to explore these further and um if you can use them definitely definitely go ahead and and do that i think particularly if you're building model driven apps this is something you would be delving into way way more the last menu item on our list here is just data so this is where we're we're doing like our select statement on our data and we're we're bringing back uh what data is contained in our entity because we've just created this there's no records in this so if we're creating an app and we want to sort of check on if our records are actually patching to our data connection or patching to our entity correctly we can go into data here and just see if those records are writing and that's just a another useful sort of tool that we have here all right so with that intro sort of done let's go back to fields because we probably want a couple more fields in here now one of the one of the things i said before is i'm a bit old school and i do like having an id field in my table that auto increments and sort of gives me this i idea of having this unique id for each record that i submit to my entity and you get that out of the box with sharepoint lists and you know with very little setup you also get that with sql tables so i want that in my my team leave entity so let's go ahead and create a field called id and that field type is going to be an auto number is it required yes and will it be a string prefixed yep but our prefix is going to be blank and minimum numbers number of digits will be one and our seed value will be one so we can see our preview here is showing us what it's going to look like which is great and this is pretty much what i exactly want so every time i create a new record in my entity my id field is just going to increment so like i said this is kind of an old-school way of thinking but i just like to build my entities like this and i always do this for my sequel tables as well so let's do that here click done so we can see here i've got an id field and a name field so let's just create um i really i'm not going to get sort of bogged down in actually creating something real here so i've called it teamly but i really i don't really care what this entity does i just want to show you how it actually works so let's just go with another let's just leave it at that hey let's just leave it that we're just going to have an id field and we're going to have a name field perfect all right so that's our entity cool like i said this is going to be a super simple entity and it's really going to make no sense at all but hey if you watch my videos you know that like a lot of my demos like i do like this and i'm usually pretty lazy with how i set these things up so yeah i'm feeling pretty lazy right now so i've just i really just want to show you how the these things work and sort of give you a really overview explanation of it so i couldn't be bothered building like a full-on team leave entity right now but hopefully you're getting the sort of message on this stuff is really sort of super simple like if i wanted to create another field i could just you know go in here create a display name and this is where i define like the data type and it's exactly the same way as how you would define a field in sharepoint where you you know you select either a text or it's a um a number field or a date field so we've got those same things here we've got text we've got text area which is like a multiple multi-line text field we've got some of these other ones which are a little bit more specific but you won't really you don't you probably won't really use these most of the time as they will have sort of more rules around them and i think a lot of the time they're they're not even really that relevant to when you're building canvas apps so probably a lot of these you don't need to bother so much with um date and time obviously yep or date only you know this stuff is just making sense because it's exactly the same as the sharepoint list right so out of there let's click cancel because we decide we're not going to create any more columns in this particular entity and let's just get straight into building an app that is going to use that entity so let's go new app and create a canvas app and we just go tablet right again super lazy approach here so let's just go straight to data and as we can see here we've got um our entities showing up let's just click on all entities and one of the entities we can see right at the top here is team leave and that's the one we just created so click on that and now we've got a data connection to our entity in cds so it's really all we need to do now is just go gallery the gallery connect it to team leave and we're going to add just some add some labels in here that is in the gallery right so in here we're going to show name and we're also going to show id let's show created on as well that'd be pretty neat that name created on borders around these so i can actually see them and one more label and it's already chosen our id field for it so that's great shrink that up make our gallery a bit shorter here okay so this is our gallery now connected to our our entity which is really as you can see that was really super simple so the next thing i want to quickly show you is how to save new records and again this is just another thing that is just crazy simple on how to do so let's just insert another screen and in here i'm just going to have a label oh yep label in that label i'm going to be creating a new name and text input for that and what was the i think that's it that's the only field that i added yeah this is a pretty lame example but again it doesn't get any simpler than this all right let's create a button call that hey look i'm just gonna let's let's make this even simpler do this all on this home screen the border around the sky as well so we can see the gallery all right i'm not even going to have a separate screen for my submit data so in here unselect want a patch and our patch is going to be team leave and this is just exactly how we we do our name column going to come from text input 1. text input 1 and we want the text value what is that patch wow this is truly this is truly a simple example right and i guess last thing we want to do is just reset text import one okay so let's give that a go in here i'm going to put any value click submit and there we go we've saved a record to the cds let's put something else in um hi there my name is gino there we go we've got two records now in if we go back to our entity and we find team leave so this is our entity team leave which we just connected to in our power app and we have um just saved a couple of records to it if we go down to data we can see our records have been created so let me do one last thing because this is just showing you how super simple this is let's create a view let's call this geno view it's just shows you how absolutely easy this is to do so in here we've got currently we're just showing the name field in this view but we would also like to show id and we would like id to be in front of name and we want to sort by now we want to actually sort by id descending instead of ascending okay click save on that and we call that view chino view so the last thing i just need to do now is just publish that view so now when i go back to powerapps all i need to do here is refresh my views and in here i can see tuna view and there we go i can select that view now inside of our gallery and um it's filtering exactly how i've configured that so that's really as far as i really wanted to go today um for me that even just finding out about entities and being able to sort of create um list like objects inside of the cds and then save and retrieve data from them was a revelation to me like for me it was just um taking a step into a brand new world no longer thinking in terms of how am i going to build this application with a sharepoint list background or even looking at thinking at perhaps creating something in sql the cds is far more accessible from a developer point of view or from a powerapps developer point of view than say creating something in azure and creating a sql table in azure or sql database in azure which tends to be more in the realms of you know your database administrator world and far less accessible from sort of a business thinking and a business sort of idea that a developer will work directly with a sql database this is really something that developers have been asking for having a sort of a sophisticated way to be able to handle data and work with data but is something that is accessible and is at the sort of level of more at the application developer level yeah it's great and you know i i definitely recommend you take a look at it and think think about building your nest next application using cds because it's really gonna future proof things for you and and give you a lot of options moving forward hey hit the like button if you like this video comment something in the comments section below and of course subscribe to stay up to date with all my latest videos i thank you so much for watching i'll see you in the next video
Info
Channel: Chino Does Stuff
Views: 5,003
Rating: 4.9499998 out of 5
Keywords: commondataservice, powerapps, cds, office365, sharepointonline, sharepoint, o365, microsoft365
Id: iI5K23MaBm4
Channel Id: undefined
Length: 34min 1sec (2041 seconds)
Published: Tue Sep 29 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.