Hi all.
I have code in my Patch button.
ForAll(
Split(
Concat(ListBox1.SelectedItems,EmployeeCode,","),","),
Collect(boxCol,Result);
Patch(ProjAs,Defaults(ProjAs),{
EmployeeCode: Result,
StartDate:DatePicker1.SelectedDate,
EndDate:DatePicker1_1.SelectedDate,
Project: Dropdown2_1.Selected}
)
);
I want to Patch values "Result" in Collection to the LookUp Column "EmployeeCode".
Is there any way to do it. Thank you!
Solved! Go to Solution.
You do not have Allow Multiple Values checked, and I assume it was (My purpose is to assign multiple employees) ? The code I supplied was on the assumption that this was set. If you are only storing a single value and the Items of the Combo Box are as per my last post, then
Patch(
ProjAs,
{
EmployeeCode:
{
Value: ListBox1.Selected.Value,
Id: ListBox1.Selected.Id
},
StartDate:DatePicker1.SelectedDate,
EndDate:DatePicker1_1.SelectedDate,
Project: Dropdown2_1.Selected
}
)
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.
Visit my blog Practical Power Apps
hi, might need to see what type of column the Employee code column is but you should be able to do the below assuming it's not a choice column
ForAll(
ListBox1.SelectedItems.EmployeeCode As MyUpdate
,
Collect(boxCol,MyUpdate);
Patch(ProjAs,Defaults(ProjAs),{
EmployeeCode: MyUpdate,
StartDate:DatePicker1.SelectedDate,
EndDate:DatePicker1_1.SelectedDate,
Project: Dropdown2_1.Selected}
)
);
Hi @Penguniii ,
Assuming the Items of ListBox1 are
Choices(ProjAs.EmployeeCode)
and (I assume) it is a multi-select column
Patch(
ProjAs,
{
EmployeeCode:
ForAll(
ListBox1.SelectedItems As aCode,
{
Value: aCode.Value,
Id: aCode.Id
}
),
StartDate:DatePicker1.SelectedDate,
EndDate:DatePicker1_1.SelectedDate,
Project: Dropdown2_1.Selected
}
)
You might also consider why you are using Lookup columns - they will cause you a lot of unnecessary grief unless you really need them.
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.
Visit my blog Practical Power Apps
ClearCollect(boxCol,ListBox1.SelectedItems.EmployeeCode};
Patch(ProjAs,
ForAll(boxCol As TableItem,
{
EmployeeCode:
{
Id: LookUp(LookUpColumnBaseTable,EmployeeCode=TableItem.EmployeeCode,ID),
Value:TableItem.EmployeeCode
},
StartDate:DatePicker1.SelectedDate,
EndDate:DatePicker1_1.SelectedDate,
Project: Dropdown2_1.Selected
}
)
);
where LookUpColumnBaseTable is the name of the table where EmployeeCode column has source and also EmployeeCodeColumnNameFromBaseTable is the name of the column from parent source of lookup. If EmployeeCodeColumnNameFromBaseTable is not EmployeeCode (as name) you can eliminate from code As TableItem and TableItem references.
Hope it help !
Hi everyone thank you for pay attendtion in my thread.
First, here is my EmployeeCode Property
Employee Code is referencing the EmployeeCode Column from the Employee Table.
My purpose is to assign multiple employees from the Employee table to the ProjAs(ProjectAssignment) Table.
And I can get information of people in Employee table from the EmployeeCode column of the ProjAs Table.
Thank you
You do not have Allow Multiple Values checked, and I assume it was (My purpose is to assign multiple employees) ? The code I supplied was on the assumption that this was set. If you are only storing a single value and the Items of the Combo Box are as per my last post, then
Patch(
ProjAs,
{
EmployeeCode:
{
Value: ListBox1.Selected.Value,
Id: ListBox1.Selected.Id
},
StartDate:DatePicker1.SelectedDate,
EndDate:DatePicker1_1.SelectedDate,
Project: Dropdown2_1.Selected
}
)
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.
Visit my blog Practical Power Apps