How to use PATCH Function in Power Apps Insert and Update data

How to use PATCH Function in Power Apps Insert and Update data Hello everyone raza here this video is all about the patch function in powerapps we will start with the basics of the patch function to insert and update data in a sharepoint.

How to use PATCH Function in Power Apps Insert and Update data

List then i will cover error handling then showcase an app that we will enhance by leveraging the patch function this will also include bulk updates by.

Leveraging patch so let's check it out in action in powerapps the patch function allows us to modify or create.

One or more records in our data source you can use the patch function to modify or create data in complex scenarios such as when you do updates that require no user interaction.

Or scenarios where you need forms that span across multiple screens to learn about the patch function the data source that i will be leveraging here is a sharepoint list called ideas.

And in this list i currently have four key columns the title text column short description text column long description multi-line text column.

And status which is a choice column in my sharepoint list let's begin with giving the ability to the user to create an item in that sharepoint list by leveraging the patch.

Function for that i will need to create a form like experience where the user can enter data so i will start with the text control.

This would be for the title another text control for the short description and then my third text control which i will set it's more to multi-line.

This would be my long description and i've added a few labels to supplement those text controls best practice i have renamed all my text controls.

In order for the user to take an action to create an item i will add a button control change the text to submit and on select of this button is where i.

Would like to call the patch function the syntax is patch my data source which in my case is connected in my power app here called.

Posts Related:

    Ideas

    So i will select ideas now what's the record that you would like to patch i'm trying to create a record.

    So i would use the defaults function against my data source defaults basically means i'm trying to create a new record.

    So patch my data source where i'm trying to create a new record and what is the data that i would like to patch this is where i can define all the.

    Columns that i would like to set i will open the curly braces it will list out all the columns i have a column called title so i will select this.

    Watch the data related to this that would come from my txt title so txt title dot text comma what's my next column that i would like.

    To update my column is called short description in my sharepoint list this would come from txt short description.

    Dot text and then finally my long description column which would come from txt long description dot text.

    I will close the curly braces for the update parameter related to the patch function and i will close my patch function if i was to preview the app.

    And enter some sample data and click submit this has gone ahead and executed the patch function the way i can confirm it for now.

    Is if i head back to my sharepoint list

    Here is the latest entry that i just made on the system now if i would like to display the data that is being recorded in my ideas list.

    I will leverage a gallery control i'll pick the vertical gallery place it here on the right change the layout to title and subtitle and connect this to my ideas list.

    And since i would like the latest entries to be right here on the top i will use the sort function to sort this on modified date in descending order so.

    The latest entry that i made which was pulse oximetry is right here now when you use the patch function to create or edit data the key is to understand the format in which.

    The columns expects data title short description and long description were all text type columns so my patch function was pretty straightforward.

    But what if i would like to patch the status column as well which in my case is a choice column now with sharepoint there are various types of columns lookups person type.

    Columns and more i have this reference blog post that showcases the formats that the sharepoint column types expect now in my case i'm dealing with a choice.

    Column here so the way i would patch the data for that status column would be as follows so i will copy this format.

    And in my patch function i will add another column here which is my status column and i would like to patch it using that format the format is an object which has a.

    Property called value and here i have to define the value of my choice in my case i would like to start with new.

    So whenever a new idea is created the status needs to default to new let's give this a try i've entered some sample data i will click submit.

    Here is the new record that shows up in my gallery and if i look at my sharepoint list here is the entry that has just come in where the status is set to new.

    And on very similar lines if you have a person column here is the type that you would have to provide for patching a person type column.

    For a lookup column you need the value and the id since you're looking up to a different list for multi-select type columns these are tabular in nature.

    For multi-select choice columns will be a table of choice data type values and for lookup columns it would be a table of lookup type values and so and so forth.

    Now let's try to edit data based upon a selection that the user makes in the gallery now in a gallery control there is a property called template fill.

    Which basically showcases which item in the gallery was selected to highlight the selected item of the gallery i will use the formula if.

    This item dot is selected in that case i will give it a background color of alice blue.

    Else i will keep the background color as white as i make my selection i can see the item being highlighted and for the selection that i make.

    I would like that data to be represented in my text controls that i added here to do that for my gallery control i have this property called select.

    I will set a variable called where idea and i will set it to this item this item meaning the current item that the user selects in this gallery and now for my text input controls.

    I would like to set its default value based upon the selection that the user has made in the gallery the default for my txt title column would be.

    Where idea dot title short description would be where idea dot short description.

    And default for long description would be where idea dot long description so as i make my selections in the gallery we can see the data being populated in my text controls.

    So in order for the user to create a new record i will insert an icon i'll pick the add icon place it right here.

    When the user selects this i will set that variable which is ver idea to blank so now if i select this.

    It goes to blank whereas if i start selecting my item in the gallery it will populate that respective data when blank is selected it still shows an.

    Item selected in the gallery to avoid that confusion the default property of the gallery you can set it as follows coalesce var idea and an empty object.

    Meaning if their idea has a value that would be the default if not set it to empty meaning no item is selected in the gallery when i select it highlights that item.

    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=BzZ0a3zRFUk
Postagem Anterior Próxima Postagem