cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Haze
Frequent Visitor

Patching New List Items with Unique Column

I have a SharePoint list in which I will create multiple new items with multiple same columns except one.

Date // Name // Task // Evaluator

 'Date':Date_Completed_4.SelectedDate}// 'Name': Name_Input_1.Text // Task // Evaluator': Evaluator_Input_Txt_1.Text 

This is in a ForAll loop as follows

ForAll(ComboBox_Tasks.SelectedItems,Patch('SPList' , Defaults('SPList') , {'Name': Name_Input_1.Text},{'Evaluator': Evaluator_Input_Txt_1.Text},{'Date':Date_Completed_4.SelectedDate}, 

This creates 90% of it but I now need the Task Name to be pulled from the combobox and change for each list entry.

"SP List"

Today() // Haze // Task 1 // Evaluator
Today() // Haze // Task 2 // Evaluator
Today() // Haze // Task 3 // Evaluator

1 ACCEPTED SOLUTION

Accepted Solutions

@Haze 

So what's the column name and data type of your task column in 'SPList'? If it's just a text column called Task, the code you would use is this.

ForAll(ComboBox_Tasks.SelectedItems,
       Patch('SPList' , 
              Defaults('SPList') , 
             {'Task': TaskName},
             {'Name': Name_Input_1.Text},  
             {'Evaluator': Evaluator_Input_Txt_1.Text},
             {'Date':Date_Completed_4.SelectedDate}
        )
) 

View solution in original post

6 REPLIES 6
timl
Super User
Super User

Hi @Haze 

Assuming that TaskName is the name of the display column that you use in your combo box, you can just refer to TaskName in your patch function like so:

ForAll(ComboBox_Tasks.SelectedItems,
       Patch('SPList' , 
              Defaults('SPList') , 
             {'Name': Name_Input_1.Text},
             {'Evaluator': TaskName},
              {'Date':Date_Completed_4.SelectedDate}
        )
) 

If you're not sure, I would add a label onto your form and type First(Combobox_Tasks.SelectedItems). into the Text property. The IntelliSense in the formula bar should tell you the correct property name to enter after the final dot. 

Haze
Frequent Visitor

@timl ,

Thanks for responding!

Why is Evaluator tied to the Task Name? I cleaned up my OP to make more sense. The combobox_Tasks.SelectedItems is what I want to use as the changing variable per line.

 If Task 1, Task 2, and Task 3 are selected I want the final list to look like

Date // Name // Task 1 // Evaluator
Date // Name // Task 2 // Evaluator
Date // Name // Task 3 // Evaluator

All other inputs are fixed and patch() handles that well but currently I can only get it to repeat the task name not have it different for each record.

I was thinking maybe patch to create then patch to modify?

Apologies @Haze 

This is what I was meant to say...

ForAll(ComboBox_Tasks.SelectedItems,
       Patch('SPList' , 
              Defaults('SPList') , 
             {'Name': TaskName},
             {'Evaluator': Evaluator_Input_Txt_1.Text},
             {'Date':Date_Completed_4.SelectedDate}
        )
) 

 

Haze
Frequent Visitor

@timl ,

Name is tied to a text input box, not the task name. The task is its own category.

In this example when I press "Update Date of Qualifications" button I want to create 3 list entries.

5/14/20 // Name // Task 213 ... // Evaluator
5/14/20 // Name // Task 217 ... // Evaluator
5/14/20 // Name // CCT710 ...  // Evaluator

@Haze 

So what's the column name and data type of your task column in 'SPList'? If it's just a text column called Task, the code you would use is this.

ForAll(ComboBox_Tasks.SelectedItems,
       Patch('SPList' , 
              Defaults('SPList') , 
             {'Task': TaskName},
             {'Name': Name_Input_1.Text},  
             {'Evaluator': Evaluator_Input_Txt_1.Text},
             {'Date':Date_Completed_4.SelectedDate}
        )
) 
Haze
Frequent Visitor

@timl ,

Thanks a bunch! I dont know why I didn't do that.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,714)