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
Excellent! 🙂 Have a nice evening also.
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
Is the Allow Searching option turned on?
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
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.
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
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.
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.
WarrenBelz
146,658
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional