web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch Statement for Te...
Power Apps
Answered

Patch Statement for Text Field, DropDown and ComboBox

(0) ShareShare
ReportReport
Posted on by

@RandyHayes 

 

Hello,

 

I am struggling with a Patch statement for an editable grid right now. Here is what I currently have on my Save icon. This formula isn't working and I'm not sure how to add the last part of the formula which is for a ComboBox control.

 

Patch('Project List',First(Filter('Project List', ID=ThisItem.ID)),
{'Project Number': TIProjectNumber_1.Text,'Project Name': TIProjectName_1.Text},
Type:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Value:ddPLProjType_1.Selected.Value},
Status:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Value:ddPSStatus_1.Selected.Value}});

 

Screenshots of my app interface and column types are attached. The names of my controls from left to right are:

TIProjectNumber_1, TIProjectName_1, cbPLProjOwner_1, ddPLProjType_1, ddPSStatus_1

 

In the Patch statement, I made up the names "Type" and "Status". I've watched so many videos on how to put together editable grids and Patch statements at this point that I'm getting a bit confused. I'd appreciate any help Randy or others might have to offer. Let me know if you need any other data points. Thanks!

 

Teresa

ColumnTypes.png
ProjList.png
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    154,928 Most Valuable Professional on at

    Hi @tagustin2020 ,

    Assuming Status is a single choice, you only need this

    Patch(
     'Project List',
     {ID:ThisItem.ID},
     {
     'Project Number': TIProjectNumber_1.Text,
     'Project Name': TIProjectName_1.Text,
     Type:{Value:ddPLProjType_1.Selected.Value},
     Status:{Value:ddPSStatus_1.Selected.Value}
     }
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @tagustin2020 

    Firstly, let's get your formula a little better (using "First(Filter" should be avoided as it is more performant with a Lookup). Also, you have a mistake in it and finally, replace Patch with an UpdateIf - much faster if you have the specific criteria (which you do).  And now, with that "fixed", I will add in the other combobox (with a caveat - addressed later).

    UpdateIf('Project List',
     ID=ThisItem.ID,
     {
     'Project Number': TIProjectNumber_1.Text,
     'Project Name': TIProjectName_1.Text,
     'Project Type': {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
     Value:ddPLProjType_1.Selected.Value},
     Status:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
     Value:ddPSStatus_1.Selected.Value},
     'Project Owner': cbPLProjOwner_1.Selected
     }
    );

    The caveat - this assumes that your cbPLProjOwner_1 Items is based on the underlying column, such as with a formula like : Choices([@'Project List'].'Project Owner')

     

    Note as well, if your Project type and Status have an Items property based on Choices, then you don't need all of the extra record information above, it can be shortened to:

    UpdateIf('Project List',
     ID=ThisItem.ID,
     {
     'Project Number': TIProjectNumber_1.Text,
     'Project Name': TIProjectName_1.Text,
     'Project Type': ddPLProjType_1.Selected.Value,
     Status: ddPSStatus_1.Selected.Value,
     'Project Owner': cbPLProjOwner_1.Selected
     }
    );

     

    I hope this is helpful for you.

  • tagustin2020 Profile Picture
    on at

    @RandyHayes @WarrenBelz 

     

    Thank you Randy and Warren for your prompt responses. The first formula by Randy is working the best so far, but I'm having a couple of issues with the Project Owner field. 

     

    Issue #1: When list is in edit mode, I am not able to delete my name and choose someone else.

    Issue #2: When I processed the Patch statement, my name overwrote all of the Project Owners and now appears in every item in the list.

     

    The Items property for the Project Owner combo box is: Choices([@'Project List'].'Project Owner'). I'm getting an error on the ComboBox Default property: ThisItem.'Project Owner'.DisplayName which I have attached for your review. Can you please help me figure out what I am doing wrong?

     

    Thank you,

    Teresa

    OwnerError.png
    ProjList2.png
    ProjList3.png
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @tagustin2020 

    Your Items property is good. The problem is you are setting the Default property of the combobox which doesn't do anything.  You need to be setting the DefaultSelectedItems property.  With Comboboxes you must match the schema of the Items records.  IN your case, the Items records are SharePoint User records.  So, you will need to match that.

    If your ThisItem.'Project Owner' is direct from your list, then just set that in the DefaultSelectedItems property.

     

    See if that moves you forward.

     

  • tagustin2020 Profile Picture
    on at

    @RandyHayes 

     

    Thank you Randy, I removed the formula from the Default property of the combobox. It is now blank. The DefaultSelectedItems property is set to ThisItem.'Project Owner', but I'm still not able to remove my name and replace it with someone else in edit mode. I can click the X next to my name to remove it, but if I try to search for a new name, nothing happens. When I click the Save icon, my name reappears. Is there some other property I need to set?

     

    Teresa

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @tagustin2020 

    Is the Allow Searching option turned on?

  • tagustin2020 Profile Picture
    on at

    @RandyHayes 

     

    That was the issue! Everything resolved as soon as I turned on Search. Totally forgot that part so thank you!

     

    Have a nice evening Randy,

    Teresa

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @tagustin2020 

    Excellent!  🙂 Have a nice evening also.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard