Power Apps PATCH function Tutorial with Modern Controls - ID Card Make

Power Apps PATCH function Tutorial with Modern Controls - ID Card Make Hello everyone razza here in this video I will show you how to use the patch function in power apps we will use modern controls to get the data from the user and accordingly create a new item.

Power Apps PATCH function Tutorial with Modern Controls

Or modify an existing item by using the patch function we will take data validations into account the screen which will have these modern controls we will make it fully responsive by using a.

Very neat trick there is a lot to unpack in this video so let's get started with it right away scenario here is a power app that.

Is connected to a SharePoint list that tracks employee data the list has various types of columns single line of text numbers date and.

More the home screen of the app shows the data from that SharePoint list in a gallery experience the employee data tracks information about the department the.

User belongs to we have a filter here on the home screen that allows us to filter users for that specific Department we would like to create a screen which allows ows us to patch data.

To our data source and Patch allows us to modify or create one or more records in our data source and the patch function is typically used in more complex scenarios.

It gives you a lot more control over how you want to add or update data in your data source as against what a standard form control experience offers I have a new button on the home.

Screen that should lead me to an experience where I can create new employee data in my SharePoint list and if I was to select a specific item in the gallery it should take me a.

Screen which will allow me to modify the information for the selected employee so to do that first step I I will go ahead and create a new screen I'll pick the blank screen.

Here I'll rename the screen to employee info in this I will insert the new modern header control I'll give it a logo which is an image that I have uploaded in my power.

App and the title will be employee info next I would like to create the controls so that I can take input from the user to patch it to my data source which is.

Posts Related:

    My SharePoint - ID Card Make

    List in my SharePoint list if I was to click new this will open the SharePoint form so I can see all the different column types I have as part of this.

    List title is a single line of text to create that experience here I'll go and insert the modern text control the text property to.

    Title title a single line of text so I'll insert the modern text input control that I'll position right here mode will be single line type text I can even give it some placeholder.

    Text this is my employee name department is a choice column I'll add a text control once again text is Department it's a choice column so I'll pick the modern drop-.

    Down control for the items property of the drop- down control since it's a choice column I can use choices of my connected SharePoint.

    List in my power app called employee data dot the name of my choice column which is department and this will list out all the.

    Options next is age which is number I will insert the text input control adjust the width higher date exit date are date fields so I'll insert the modern date.

    Picker controls here salary is a number again so similar to Age It's a text input control skills which is a multi- select.

    Lookup column the data is coming from a different SharePoint list so for skills I'll use the modern combo box control items.

    Property choices of

    My SharePoint list dot my column called skills so this will list out all the skills and I need to ensure that allow multiple selection is turned.

    On and finally active which is a yes no type column so for this one I will use the checkbox control and the label I will leave it as.

    Empty so at this point if I was to preview view the app these are controls that I have added which will allow the user to enter information now for the employee info.

    Screen I will go and insert a couple of buttons I'll position them here the first button the text I'll call it as back the type will be secondary and on select of this I will.

    Use the function back which navigates the user back to the previous screen the next button I will call it as submit so let's go to the home.

    Screen and let's begin with the new button on select of this button I want to create a new record so here first I will create a variable I will call it V record.

    Type I will set the value new and then I will navigate the user to my employee info screen so if I click preview select new takes me to my screen I select back and.

    Back to my home screen now when I select an item in my gallery it should also lead me to that same screen so for the gallery I have a.

    Property called on select here I will set that same variable which is V record type this one I will set to edit and then I will navigate the user to my employee info.

    Screen I also need to set another variable before navigating and I will call this where item this should have the context of the item that I would like to edit.

    I will set to this item this item will give me the context of the current item that's selected in the gallery so if I preview I select the.

    Item for Matthew now that variable is set and these controls needs to show those values coming in for that selected item so let's try the employee name which is a text input.

    Control it has a property called value this I will set to that variable which is ver item dot title you can see it shows the selected item of the gallery which was Matthew if.

    I go back and select Emily this will show Emily's name now if I go back and select new it still has that value set in that variable so what I need to do here is.

    When new is clicked I need to also ensure right before navigating I set that same variable this time to.

    Blank because I'm creating a new record so now if I click new you can see it's a new record so it doesn't have an employee name but if I go back and select any item from my gallery it will.

    Show the details for that respective item department is a modern drop- down control this has a property called default selected items I will set this.

    To V item dot my column is called department age the value will be where item. age higher date is a modern date picker control so it has a property called.

    Selected date this would be where item do hire date exit date where item. exit datee salary value where item do annual salary skills multi select lookup it's a.

    Combo box control so default selected items where item do skills active is a yes no type column here I'm using a checkbox control it has a property.

    Called checked I'll simply use where item do active so now when I make an actual selection it will load all the values for that selected item and if I click.

    New gives me a blank experience to begin with now one thing you will notice is if I I go to new the drop downs and combo boxes still hold the previous value so all we have to do here is every.

    Time we land on this screen which is my employee info screen I would want to reset those type of controls so on visible of my screen I will reset drop down canvas.

    One and I would want to reset combo box canvas one so notice if I click new this time it doesn't hold the values but if I select an existing item it will load.

    Those values I'll click new now let's go ahead and submit the data and this is where we'll use the patch function so when submit is clicked use.

    The function called patch data source that you want to patch to which is my connected SharePoint list employee data comma.

    Record which record are we trying to patch now if we are creating a new item we need to use a function called defaults and if we are patching an existing record we need to give the.

    Context of the item so for the record Property I'll use a condition if where record type is equal to new I will use the formula defaults of my connected data source which is.

    Employee data else I am modifying an existing record here I need to give the context of that record which I already have in a variable called ver.

    DISCLAIMER: In this description contains affiliate links, which means that if you click on one of the product links, I'll receive a small commission. This helps support the channel and allows us to continuetomake videos like this. All Content Responsibility lies with the Channel Producer. For Download, see The Author's channel. The content of this Post was transcribed from the Channel: https://www.youtube.com/watch?v=HMN-SWwkA3Q
Previous Post Next Post