Patch('List Employee Details',{ID:ThisItem.ID},{Title:txtTitle.Text,'Employee Name':txtEmployeeName.Text,'Employee Address':txtEmployeeAddress.Text,'Employee Contact':txtEmployeeContact.Text ,'Marital Status':LookUp('List Marital Status','Marital Status1'=ddlMaritalStatus.Selected.Title,ID) });
Here 1st 'Marital Status' is destinatination list field name .
'List Marital Status' is Datasource name.
2nd 'Marital Status' is list coumn name from the data gets filled in dropdown .
'ddlMaritalStatus' is dropdown .
Here in 'List Employee Details' list I hve lookup the 'List Marital Status' list field 'Marital Status' .
Error :
the type of this argument 'Marital_x0020_Status' does not match the expected type record , found type number .
Please help .
Thanks .
Solved! Go to Solution.
What type of DataSource are you using? SharePoint, Excel, SQl, other?
I'm assuming SharePoint...
What type of column is the Marital Status column? A choice or a lookup or a text?
If it is a text column, then yes, this will fail. Here because you are trying to assign an entire record from the Lookup, to the Marital Status column, AND, you are giving a default value (if the lookup does not find a record) of ID which is numeric. You would need to put a ".something" on the end of your lookup to grab the actual value you want from whatever column you want:
Patch('List Employee Details',{ID:ThisItem.ID},{Title:txtTitle.Text,'Employee Name':txtEmployeeName.Text,'Employee Address':txtEmployeeAddress.Text,'Employee Contact':txtEmployeeContact.Text ,'Marital Status':LookUp('List Marital Status','Marital Status1'=ddlMaritalStatus.Selected.Title,ID).SomeColumn });
Is this a Choice column? Then you will need to do a little extra to assign the value.
Patch('List Employee Details',{ID:ThisItem.ID},{Title:txtTitle.Text,'Employee Name':txtEmployeeName.Text,'Employee Address':txtEmployeeAddress.Text,'Employee Contact':txtEmployeeContact.Text ,'Marital Status': {
Value:LookUp('List Marital Status','Marital Status1'=ddlMaritalStatus.Selected.Title).SomeColumn,
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
}});
If this is a lookup reference to another List, then there is one more piece needed:
Patch('List Employee Details',{ID:ThisItem.ID},{Title:txtTitle.Text,'Employee Name':txtEmployeeName.Text,'Employee Address':txtEmployeeAddress.Text,'Employee Contact':txtEmployeeContact.Text ,
'Marital Status': { Value:LookUp('List Marital Status','Marital Status1'=ddlMaritalStatus.Selected.Title).SomeColumn,
Id: Lookup('List Marital Status','Marital Status1'=ddlMaritalStatus.Selected.Title).ID '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
}
});
Ideally, you can have the records of your DropDown list contain all of these items so that you can just reference them in the Patch without using Lookup's, but that's a different topic.
This should get you going - if again, this is a SharePoint list.
Hope this helps.
What type of DataSource are you using? SharePoint, Excel, SQl, other?
I'm assuming SharePoint...
What type of column is the Marital Status column? A choice or a lookup or a text?
If it is a text column, then yes, this will fail. Here because you are trying to assign an entire record from the Lookup, to the Marital Status column, AND, you are giving a default value (if the lookup does not find a record) of ID which is numeric. You would need to put a ".something" on the end of your lookup to grab the actual value you want from whatever column you want:
Patch('List Employee Details',{ID:ThisItem.ID},{Title:txtTitle.Text,'Employee Name':txtEmployeeName.Text,'Employee Address':txtEmployeeAddress.Text,'Employee Contact':txtEmployeeContact.Text ,'Marital Status':LookUp('List Marital Status','Marital Status1'=ddlMaritalStatus.Selected.Title,ID).SomeColumn });
Is this a Choice column? Then you will need to do a little extra to assign the value.
Patch('List Employee Details',{ID:ThisItem.ID},{Title:txtTitle.Text,'Employee Name':txtEmployeeName.Text,'Employee Address':txtEmployeeAddress.Text,'Employee Contact':txtEmployeeContact.Text ,'Marital Status': {
Value:LookUp('List Marital Status','Marital Status1'=ddlMaritalStatus.Selected.Title).SomeColumn,
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
}});
If this is a lookup reference to another List, then there is one more piece needed:
Patch('List Employee Details',{ID:ThisItem.ID},{Title:txtTitle.Text,'Employee Name':txtEmployeeName.Text,'Employee Address':txtEmployeeAddress.Text,'Employee Contact':txtEmployeeContact.Text ,
'Marital Status': { Value:LookUp('List Marital Status','Marital Status1'=ddlMaritalStatus.Selected.Title).SomeColumn,
Id: Lookup('List Marital Status','Marital Status1'=ddlMaritalStatus.Selected.Title).ID '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
}
});
Ideally, you can have the records of your DropDown list contain all of these items so that you can just reference them in the Patch without using Lookup's, but that's a different topic.
This should get you going - if again, this is a SharePoint list.
Hope this helps.
Thank you. I will try this.
I tried as mentioned , but data not saving .. please help .
Patch('List Employee Details',{ID:ThisItem.ID},{Title:txtTitle.Text,'Employee Name':txtEmployeeName.Text,'Employee Address':txtEmployeeAddress.Text,'Employee Contact':txtEmployeeContact.Text , 'Marital Status': { Value:LookUp('List Marital Status','Marital Status'=ddlMaritalStatus.Selected.Title).'Marital Status', Id: LookUp('List Marital Status','Marital Status'=ddlMaritalStatus.Selected.Title).ID, '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference" } })
In the 'List Employee Details' list - what type of column is 'Marital Status' ?
In the 'List Marital Status' list - what type of column is 'Marital Status'?
In the 'List Employee Details' list - it is Lookup
In the 'List Marital Status' list - it is Single line of text
At a glance...it all looks fine. But wait, as I was writing this I looked over your formula again and see the issue.
Your Patch statement is all wrong - you're actually not even patching a record.
You need this:
Patch('List Employee Details', Lookup('List Employee Details', ID=ThisItem.ID),
{Title:txtTitle.Text,
'Employee Name':txtEmployeeName.Text,
'Employee Address':txtEmployeeAddress.Text,
'Employee Contact':txtEmployeeContact.Text, 'Marital Status': { Value:LookUp('List Marital Status','Marital Status'=ddlMaritalStatus.Selected.Title).'Marital Status', Id: LookUp('List Marital Status','Marital Status'=ddlMaritalStatus.Selected.Title).ID, '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference" } }
)
As you see in the above formula, you NEED to provide the record that is going to be patched. In this case, a Lookup of that Record will give what we need for Patch to work.
If you were creating a New record, you would substitute the Lookup with Defaults('List Employee Details').
Make that change and your problem should be solved.
Hope that helps.
Fixed the issue by changing the -
ddlMaritalStatus.Selected.Title
to
ddlMaritalStatus.Selected.Value
Thank you for your help .
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
209 | |
70 | |
49 | |
48 | |
20 |
User | Count |
---|---|
256 | |
125 | |
84 | |
77 | |
72 |