YAML Essentials for the Power Platform

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so what in the world is this thing called yaml and why should you care about it and what are the use cases for you as a Power Platform person well yaml is a data serialization language that was created back in 2001 and it's actually a superet of our friend Jason and it uses an indent based syntax and it's meant to be more readable than Json now you might be wondering what the name means and where it came from I found this really funny originally the acronym stood for yet another markup language as a funny commentary on the fact that there were a ton of markup languages out there but it was actually changed a few years later and it was changed to yaml ain't markup language and this change was made to emphasize y's more data oriented purpose and it also made it a double acronym or an acronym within an acronym it's just a really funny story and I'm all here for it and I love it like Json yaml focuses on keys and values and the main difference is how it's presented so instead of using brackets and quotations like we do in Json yo uses spaces and indentation and you'll see two different file types used for these yl files it's either yml or yaml so you might be thinking cool story but why should I care about yaml as a Power Platform person it might sound way too developer or unrelated to you well yaml is used all over the place in the Power Platform so if you're using co-pilot studio and you're wanting to copy nodes and be able to edit those or more recently there's been some investments in being able to edit power apps canvas apps with yaml directly so understanding the fundamental concepts of yaml and how to use it and work with it are going to become increasingly more important for you as a Power Platform person so let's take a look at an example of a yaml file here and we can explain some of the basics of what's going on so you can get a fundamental knowledge and then we'll talk about how to apply this to the Power Platform my recommended way to work with these yo files is in Visual Studio code it's a recognized file type so if you do yml or yaml you can create a new yaml file that way and all the syntax and everything will be recognized first thing you'll notice is the use of hashtags hashtags and yaml are how we put in comments so we can explain what's going on in the file so you see I have a few comments all over the place now yo uses a series of keys and value pairs so you'll see those all over the place in this file and this makes it really easy to understand what's going on there's all kinds of different types of objects that we can deal with inside of a emo file so let's go through each one of these the first first one is a string so we have our key right here which is employee name and you'll notice in some of these keys that I have underscores in the names that's because we can't have spaces in the names there so we can either do a camel case or an underscore whatever format you want there we just can't have spaces so I have a key of employee name and then I have a colon so that's how we separate our keys and values just like we do in Json and we have a value of Michael Scott now this is where we start to see differences between yaml and Json because in Json if we were doing this we would have to have this value for the string in quotes we don't have to do that in yaml but the cool thing is because this is a super set of Json Json is technically a readable file in yaml so if I wanted to put Michael Scott in quotes either single or double quotes you see it will still respect that value but from an ease of use and a readability perspective alone it's really nice to not have to put those quotes in your values and it can automatically recognize those as the correct object type here so that's how easy it is to do a string now let's take a look at an integer so same thing we're going to have our key of employee age we're going to do the colon and then we'll simply type in the number value and you'll notice that the color here is different so it's kind of a lighter green compared to this orange color for our string so that's showing us that it's recognizing the difference between a string and an integer in this case if there's any reason where you want to type in an integer but have it be recognized as a you could do things like wrap this integer in double quotes and that will convert that for you to a string object now what about if you need to have multiple lines of text so there's a special way of handling that so we have our key of employee quotes and the way that we allow for multiple lines is before all of your text you'll put a pipe and then you'll have a new line and you can just keep adding as many new lines after this pipe one of the other data types that we can work with is a Boolean value so again we'll have our key right here of is manager and we can simply put in a true or false value here again notice the difference in color letting us know that it's recognizing this as a bullan value and the cool thing about Boolean values in yaml is they accept multiple values here so we can do the traditional true or false or we can do yes and no and we can do on or off so those are all supported for your Boolean values so let's keep going through these data types what if we want to have a list of values so we can do that pretty easily here so we'll have our key value of favorite quotes and we simply put in a dash and then the value so I can do a new line here Dash space and I can put in a value there so this is just another example of a list right here and another example right here of an integer value and with these integers it doesn't have to be whole numbers we can have a decimals like that if we want to so it supports all that so we looked at list but what about collections of information so this is a good example right here where we might want to have a collection of cats and we need to track multiple pieces of information about these cats so we might want to know the name and the breed and these are called dictionaries in yaml so you can create a list of dictionaries by putting in your key so I want a dictionary of cats and then we'll do some more key values below so we'll do a dash here to note the first list item so we'll have our key of name with the value of sprinkles and then we'll just insert a new line without a dash so this is basically creating a grouping as you can see and we'll have the key of breed with the value of Persian and if we have a new item within this we'll just do another Dash with a name key and a value of Bandit and we can use these dictionaries in different ways so in this case if we want a dictionary of finances we might have different pieces of information so I might want to track an integer value for income but we might also need within this dictionary a list that shows the different expenses so we can mix and match those in the dictionary like so and there are just more examples of showing list of strings versus a list of integers and things like that and I'll make this sample file available on my GitHub and reference that in the video description there so that you can downlo downlo it and install and learn more about this and if you're wondering as I was typing here where I'm getting these suggestions this is actually GitHub co-pilot in action I love it so it's even recognizing the theme of my yaml file here and coming up with suggestions which I love so big thanks to GitHub co-pilot here for making building this yamel file even easier now that we have a basic understanding of yaml let's take a look at where we'll use it in the Power Platform there's two main places where we're going to use yl right now that's in co-pilot studio and power apps so looking at co-pilot studio if you go into a topic that you define we can actually view the source code which is yaml directly from here so I'm in a topic with inside copilot studio right now I have this built out we're calling an AI prompt to be able to get proposal information and I could continue building this out by adding individual actions sending messages asking questions and all that but we also have the ability to view the code behind mind which happens to be yaml so within the topic we can click on this more button and we can go to open code editor and this is showing us the behind the scenes of everything that's happening in this topic but in a code view which is yaml so hopefully this looks familiar to what we just looked at in our sample when we are understanding the basics of yaml so we have a key called kind with a value of adaptive catalog we have a dictionary value called begin catalog and we have a key called kind with the value of on recognize intent so this is one way if we want to make changes we can do it through this experience it's a good way to get a holistic view of what's going on with the topic so if you have a really big topic with a lot of nested conditions and things like that that could result in Endless scrolling one benefit of knowing yaml and using this code view is being able to get a clean all up view of what's going on in the topic and to even be able to make mass changes but the biggest benefit in knowing yl across Power Platform and you'll see when we get to power apps that this applies to that as well is being able to easily share your code so if I build out this topic that does something really cool and I want to put it in another environment that I have or if I want to share it with someone all I have to do is copy this yaml and I can save this out wherever I want and I can go into any one of these other co-pilots now and I can go into the topics here I'll just add a new topic we'll sa from blank and now I can go over to the more tab here and I can just replace what's in there with that yaml and now if I click save now we have that same topic right here in a completely separate co-pilot and this right here is why I love this EML functionality the reusability of this and being able to easily copy and paste things that you build into other environments other Solutions even giving it to other friends sharing it out on samples repositories like I'm passionate about and I create content on this is going to really make that so much easier so this is how we can use it in copilot Studio let's go over to power apps and see how we can do something similar so for a while in the CLI we've had the ability to be able to unpack our canvas apps and that was essentially unpacking the code and allowing us to see the yaml of the app but we don't have to mess with the CLI anymore to be able to view the yaml in our canvas apps at build they release the capability to view and copy and paste yaml from our canvas app so if we go into any object here like I built out this nice looking gallery that has some formatting on it I can right click on that and now we have this view code option this is opening the yaml view of this canvas app and this right here my friends is what got me really excited about yaml being able to have this capability to see everything that's going on in your canvas app in a particular object or the app as a whole is really cool so I don't have to go into the drop- down and click on each property to see what formulas and things are in there I can just look through the amml so I said to view the code for the gallery control I can see all the properties so here is the on Select Property I know exactly what's in it there's a launch function I have my items property with the filter we got the wrap count the Align and container it's just a great way to see all of the stuff that's going on with inside your app so this will give you a readon preview so you'll see that I can't type in it or anything like that to make changes directly in this code editor but what I can do is say copy the code and we'll go into our friend Visual Studio code and we'll create a new yl file and we'll paste all that code in here and now I can make any edits that I need to make so say I just need to change this URL right here I can do that then I can copy this back is where the magic happens so I'm going to go into a completely unrelated different application and I'll just add a new screen so we have a blank canvas here and then we'll go to right click we'll say paste code so it's taking that yemo that I have and putting it into my app now this doesn't look magic right now that's only because we're missing a data source so let's go add in our data verse table and we're just missing a dependency on a TBL list so I'm going to use this magic trick again and we'll copy this tab control so I copied the code easily there and we'll go and we'll paste that in and I just fixed one quick thing there behind the scenes with this TBL list with a reference to the wrong screen name since I put it in a new app and now we have that nice looking Gallery over over here in our other app there's a few implications with this yaml capability it's not only going to make it easier to have our apps in Source control and follow healthy practices there is going to also make it easier just to share apps that we build many of you are probably aware of the Power Platform samples repositories and here we can go and upload examples of sample power apps like I've done with this leave request so to share an entire app of course we want to add that to a solution with any dependencies like data sources and all that but what if I only wanted to share one specific aspect of this like maybe I like how I did The Styling on this company holiday section and I just want to share that piece well this yaml capability is making that possible now we can have a library of Snippets of yaml that we can copy and paste individual Widgets or components in our power app and we actually have a GitHub repo for these Snippets so if you go look there's existing Snippets out there right now for a copilot studio so we see we have one for a Time message topic for example and we can look at that we'll go to the source here and here is the yaml that you can copy and paste into co-pilot Studio to be able to have this timeout message and we'll be adding more to this repo I'll be adding a lot I know for power apps Snippets as well of yaml that you can copy and paste inside of your applications so in my opinion if you haven't already looked into yaml you need to start now because this is going to be increasingly more important for you as a Power Platform developer and as we just looked at there are a lot of benefits to this one just being able to see everything in a better view so being able to see what's going on in your app and what's going on in your co-pilots even being able to make some mass changes and more importantly being able to share your co-pilot studio and your power app Snippets of code and easily pce those and move those around between environments and with your friends and colleagues so I hope this was a good primer on yaml what it is how it works and how to get started with it in the Power Platform let me know what you think about this in the comments I would love to know what your experience has been if you use this before and if you want to keep learning and you want to learn more about Json and how you use that within the Power Platform I have a video that you can check out there so thanks so much for watching I hope you enjoyed this video and if you did hit that subscribe button so you can be notified for future videos I'll see you next time [Music] [Music] w
Info
Channel: April Dunnam
Views: 3,153
Rating: undefined out of 5
Keywords: YAML for Power Platform, YAML, YAML Power Apps, YAML Copilot Studio, YAML Microsoft Copilot Studio, yaml basics, power apps yaml, Copilot Studio, April Dunnam, powerapps, power apps, visual studio code, power apps tutorials, vs code, learn powerapps, microsoft powerapps, power apps low code, power apps code review tool, power apps code view, power apps code, power apps visual studio code, power apps custom code, power apps source code, power apps source code tool
Id: O7X1bFrfg2E
Channel Id: undefined
Length: 14min 36sec (876 seconds)
Published: Mon Jul 01 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.