How to use Power Apps Patch with Updates for complex SharePoint columns

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone this is daniel and in today's video i'm going to talk about how to use powerapps patch with updates for complex sharepoint columns and you are going to love this video because using this new technique that i've come up with you can take that patch formula which sometimes can be a long list over here and using the technique you can slice it down to even half or even one third so stick around i'm gonna walk you through it but first here's my intro video [Music] so let's get started what i want to do first over here is look at that sharepoint list and you must have seen me use the sharepoint list for a scenario where you're making you know hotel reservations or travel reservations so i'm going to continue using that same example but i want to show you the back end list just as a reminder so go to the list settings over here and in my list settings you will see these columns and what i've done is i'm going to start off with the simple ones like the single line of text the multiple nano text the currency those are the three easy ones but then i'm taking it to the next level i'm going to start with choice i'm going to do lookup i'm going to do manage meta metadata and then the people are grouped with multiple select i'm going to add those as well because four those four get really tricky so i'm going to add that all right so now that you've seen the uh the sharepoint list let me spend the next few minutes just talking about the comparison between the existing techniques to do it which is the edit form and the patch functions that we've always used so let's go take a look at that all right so this is my app made it look a little nicer just to kind of give a little wow factor to it but all in all it is still the travel reservation app right this is the reservation app that companies use internal in the company um and you know make reservations so first technique that i want to show you is the with the edit form and this is simple it is powerful nothing too fancy but that's also it it's nothing too fancy so you really can't go ahead and elaborate too much on the design over here but all in all it is still very powerful if i click on it you can see that this is my form when i click on the form all of this information is over here you know the columns that i've selected all of them and you know so the first name last name address zip code amount and cache and the notes these are all the simple ones because they are just the single line of text and then so on and so forth where things get interested is where you have the city and the state those are the lookup ones and then so on and so forth even the guest name with the multiple select so when it comes to the submit form or using the edit edit form it's literally that simple it's just a submit form i'm going to go ahead and submit the form reset it navigate it back and then i have a variable just to keep track of things which are going on and so that's that's the simple way all right but one of the things about the edit form which i kind of don't like too much is that yes it's simple but i don't have too many options to beautify the form and give it that extra wow factor and elaborate on the user interface and the user experience so that's when i had come up with the next technique which is the patch function it's not that i came up with it that's the next technique that's available which is the patch function and as you can see if you do a side-by-side comparison that's the edit form over here and then that's the patch function it gives me the flexibility to go ahead and move stuff around it also gives me the flexibility to kind of change some of the things around which is you know the single and the double line now sorry the single bed or the double bed if you went ahead and looked at it for the previous one it was just a drop down but now i went ahead and gave it the option to go ahead and put it as a single uh as a as a toggle switch same thing for smoking if i just use the out of the box edit form over there i can just make it as a drop down over here i can make it again as a radio button and switch to the horizontal same thing with pets over here now when i take this combination of the patch function i look at my save and this is where it gets really interesting i mean i did a copy and paste on notepad plus plus and it's over 70 lines of code but this is legitimate code right and i broke it down such that um the combo the guest name for the um the guests who are coming the people in groups with the multiple select whatever i've selected i first drop it into a collection so that's the first thing you got to do then you got to go and patch it and what i did was in the first four or five months it's just the text columns regardless of whether they're single or multiple they're just text so that's why i've gone ahead and saved them over here then came the interesting one which was the multiple people columns and multiple people columns i have leveraged the combination of the collection to go ahead and drop those people in the collection and then using a for all i use this function which is to go ahead and save it directly into sharepoint as the right column which is the people in groups and to do that you've got to do all of this stuff over here and then for the lookup columns doesn't get any easier you've got to go and do oh data type again the same thing as the orderdata connection over there directly call that function i mean you save it you have to know the id the value i mean you've seen this before many of you are doing patch functions you've seen this before and so i just want to kind of elaborate on that is that this is how i'm doing it with the patch function you know it doesn't get any easier it is what it is right down to the manage metadata now that you've seen those two let me show you the third one which i have started using and here's what it is it is what i call a new way and again the look and feel is almost the same and if you've already realized the difference it is because um in the powerapps with the patch function this one over here the single or double bed was a radio button and i went ahead and used again the dropdown very similar to the edit form same thing for the smoking same thing for the pets gone ahead and added that but i've got the flexibility stage still to design things how i want and i'll show you a big clue watch over here i can put a gap over here this is something you can't do in the edit form i could go ahead and move things around would i see fit i could just put one line over here i could go ahead and sort things out however one still that same uh canvas design and then you do patch function you're not bound inside that edit forms limitations over there you directly put you know you can go and match things however you want desire however you want that's the beauty of the patch function but check the formula okay i'm going to click over here save and bam that's my formula it's literally less than half of the big patch function you saw over there and i know some of you already got a glimpse of it and say hey daniel you did something similar like that with the attachment form is that the same technique says yes it is exactly the same technique that's where i got the idea from two big changes i did was in the patch and in the attachments over there um in the previous video i've put the link down to that by the way i put it after the first patch and then got the id and referenced that over here you don't even need to do that you just do it directly in the first patch and what happens is i've still shown it in two ways where i will combine the two thing which is the patch and the updates by the way updates this part of the edit form functionality over there so what i've done is i've gone ahead and basically still the single line of text ones multiple layout text the currency went ahead and just patched it just the way it is but then all those complex ones i'm just going to use the updates form so what is this updates form for that let me actually click on one and i'll even demo how to do so let's go to that complex ones which is the uh the single and then the the singular or double bed smoking these are basically those complex ones so if you see on the left side the trick that i'm using is i'm getting each and every one of these complex ones columns i'm getting them as an individual edit form and in the edit form i go ahead and connect it to the data source get only that field and then when i come to the point to patch it i use this very specific formula let's get the form of form number name dot updates it's as simple as that and it will save it with the same time as you're saving the first data which is the with the along with the patch function over here same thing i'm doing for all these other ones over there see that's why if you look at the way my tree view is there's just basically multiple forms there's a smoking one which is for smoking and non-smoking the pets one all of these the complex ones each of them are individual edit forms and then after in the edit including this tough one over here which is the people or groups with multiple select remember in the patchway i have to do a whole lot clear collect then go ahead and do a forall none of that over here is just one line and for that again it is a simple form one form in its tied to that one specific column or field and then you go and patch it so let me give an example on that okay we come back over here now to a blank screen that i have and i'll only focus on those complex columns so for the first one i'm going to come now straight to my forms and go to edit and then what i've been doing is i'll go ahead and now say get the smoking and non-smoking so come back here and go ahead and rename it and i'm going the demo smoking non-smoking form next i go to the data source and for the data source you got to go ahead and make sure that you tie it to that sharepoint list you just have to um and i come over here and i go to the patch and in my patch first thing it will do is you know how this edit form functions you go ahead and tie it to that sharepoint list it will go ahead and get all those columns in so that's why the first time you do this go ahead and just get the first the you know that specific column that you want and for the rest you basically just do a copy and paste in the copy and paste i'm going to show you that technique over here so again for this one i'm going to do the smoking and non-smoking so i'll go ahead and remove that i'm going to go through that really fast and see here we go this is a single edit form and it's got that single field in it now that you have that go ahead and do whatever you know just a little bit of massaging that you need to get done this guy sometimes gets to do the tricky part just because of where the edit form behaves but there you go now i've gone ahead and just treated this as a very single field and in the single field it's going ahead and behaving just that way and so now when i do that i've already got that edit form and the field in it so i don't have to make any data connection to that control and then going ahead and you know passing that along to the next thing you still have to go ahead and treat it like an edit form because right here now when i select it i've got in my item when i go to the default item it is the smoking but when i go to actual form the data source is there the item i'll go ahead and go ahead and put in the defaults and put it to the patch list which in my case is called patch item your list could be anything and so therefore now when i look at it it looks just like a single field which would be the exact same representation of the powerapps patch function you can also go and elaborate that and design a little bit more so right in that card if i go to the single data card value i want to match it to this color theme that i have i go to the chevron color go ahead and do the collection and now even that control looks like it is again coming individually not with an edit form let me continue with also going ahead and adding it now to another very tricky one and that is the people in the groups so for that what i do is i first go ahead and not select the card but select the entire form right and then you do a ctrl c a ctrl v which is copy and paste got it come back over here i'm going to rename this to something that makes sense to me so i'm going to say the i'm going to keep the form i'm going to keep the demo i'm going to just say people group got that come here now i go to the edit fields you can actually go ahead and remove this one i go ahead and add it and that is this people and group column for me is called as guests so let me go get my guest i think i just passed by there it is guest names selected it and go and add that and then like i said you still got to go ahead and you know clean this up a little bit not too bad right grab that i can go and i can click on this one say there get the color and that's literally as simple as that so the smoking and the smoking and the guest one were two really large formulas on the patch function when i put it over here with the edit form it's a lot simpler um also to elaborate let's just go and put these other funky ones too like the first name right there i'll put that in you know first name just the label that's what i do rename that to uh i call it demo first name label you know how i am with labels if it's a label i make sure that the display mode is set to view next i'll go ahead and drop a text because it's going to be my first name text so change that because i'm going to be patching it that's why i need to know exactly what that control is into two of them ctrl c ctrl v move that over here now i can make this as my last name or surname both the same right and rename the label here the demo is going to be last name this one rename that more important to rename this text one than the other label because this is the one i'm going to be using so class name okay and this is just two really solid examples this is the lookup one this is the people and groups of the multiple select so let me now show you how i'm going to go ahead and save it in the on select that doesn't change i'm going to pretend like it is a patch conflict and it is a patch so click on patch i'm gonna get the data source which is patch it and just send up this sort of patch match match everywhere just make sure that the patch is the function and then patch it is the name of my sharepoint list so i'll clear that out defaults again goes back to patch it comma shift enter shift and get my open brackets i do double shift uh close brackets and i'm going to keep it there for now in fact i can go and close it for now right and the first one i'm going to do is this is the first name so now in the patch intellisense also knows that sharepoint list because i mentioned the sharepoint list over here and the name which is apache so if i start typing in first intellisense tells me hey you've got a sharepoint list named patch name a first name is that the one you want to use yes that's the one i'm going to use so i went down and i hit enter and i got that now i need to just reference the name of the column the column so this was the one for the first name what i do is the new technique that i've been working with is i come over here and select the column name i don't even spend time scrolling around if it's a smaller tree view then yeah you can find it but what i do is i click over here come up to the text input double click ctrl c got it come back over here and paste it and this was going to be the text so we got our window now let's do the second for the last name so we're coming into the um last name intellisense gave me the name perfect this one is a demo last name so let me start typing in demo last name a demo last name text dot text and i got those two important ones done next is this is how i did it for the other one by the patches i went and grabbed those single line multiple line currency that's the easy ones went and grabbed it over here the next one was as an example is the when i'm now adding the update to the patch the one which is the class close bracket i come to one left of it so this is between the curly brackets and the close bracket curve bracket i come there and i make sure i just get the curve bracket out next i put in a comma all right comma and that is where you start adding those other forms it's literally that simple so for the sake of this example let's go grab those two that we did the smoking one which i did smoking a non-smoking room you got to come and select that and make sure you get the entire form name not just you don't worry about the data card or the data card um or the data card value you go and get the entire form name and for that you can just double click over here do a ctrl c go back to my save and in my save i'll go in now remember at this point i paste it and hit dot updates and that's it i can do the other one over here go below that and grab the other one which is the guest names again not the data card or the data card value you want to get the form that's why i went and named it that behind it with the form that makes sense double click on that to get the correct name control c come back here and paste it right below that dot updates and there you go see no big complex formulas that i got to figure out or delete it's literally that easy to go ahead and make that and this is basically what i've done for all the other ones i don't care how complex the column is i don't care what all is the back-end connections over there i just go ahead and pretend that each and every one of those columns is my edit column and it works so if i go and now do a save remember the only four items are going to be saved his first name last name smoking non-smoking so i'll go and say um danielle and i will say christian smoking i am a non-smoking person so remember when i just selected the data card value sorry when i selected just the edit form and then then tied it to that field automatically the data came with it like i didn't have to go like in the previous patch function i would put a drop down or the combo box i would have to attach it to the patch function so that one step also be saved which means it's not just saving us the time to make a long patch function it's also saving us time to build the form so i'm not non-smoking my guest name i'm going to say for now is going to be myself and multiple selects i'm going to say it's going to be my wife as well so rosanna the two of us items too go ahead and save it see the ants marching over there so let's go and take a look at our list when i go take a look at list there's the new one that came in the first name last name was daniel christian and then the only other was was the smoking got that and then the two which is the daniel christian the rosanna christian that simple wasn't that awesome so let's do a quick recap the quick recap i showed was i was able to combination of the patch function and the update function the update is the same as we do in the submit form and what i did was i went ahead and showed an example that with the patch go ahead and use those simple ones single line of text multiple line of text currency go ahead and use those but for those complex ones like the lookup multiple choice multiple select for the people in groups and dreaded managed metadata hey now it is easy go ahead and just add each of them as an individual field in each edit form and it just works and then after the patch function just go ahead and add the form name dot updates and just keep adding them so if an example if you saw when i compared the two one of them had literally 75 lines of code the big mega patch function but the other one like 18 lines i mean we sliced that down into less than half and more importantly became very easy so hopefully this video was helpful to you as always keep powerapping thank you so much for watching my youtube video remember this is all free with fresh content that is updated on a weekly basis so if you've already subscribed to my channel thank you and spread the word if you haven't already subscribe click on the bell notification and let the learning begin
Info
Channel: Daniel Christian
Views: 2,998
Rating: 4.9642859 out of 5
Keywords: How to use Power Apps Patch with Updates for complex SharePoint columns, SharePoint Lists, SharePoint People and Groups, Daniel Christian MVP, Daniel Christian Power Apps, powerapps patch examples, powerapps patch sharepoint, powerapps combobox example, powerapps patch, powerapps patch sharepoint list item, powerapps patch sharepoint list lookup column, powerapps patch sharepoint list person field, powerapps patch managed metadata, powerapps patch sharepoint list date field
Id: FmCdUMmm8xg
Channel Id: undefined
Length: 19min 46sec (1186 seconds)
Published: Sun May 23 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.