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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch the Collection V...
Power Apps
Unanswered

Patch the Collection Value to LookUp Column in SharePoint List

(0) ShareShare
ReportReport
Posted on by

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!

Categories:
I have the same question (0)
  • C-Papa Profile Picture
    1,836 on at

    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}
    )
    );

  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @Anonymous ,

    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

  • CU-18081211-6 Profile Picture
    9,270 Moderator on at
    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 !  

  • Community Power Platform Member Profile Picture
    on at

    Hi everyone thank you for pay attendtion in my thread.

    First, here is my EmployeeCode Property

    Penguniii_0-1660729542154.png

    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

     

  • Verified answer
    WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    @Anonymous ,

    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

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard