cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
amralomari
Helper III
Helper III

Patch multiple columns from multiple checbox

Dears 

 

I've an application where user choses couple of periods, using Mr. Reza's tutorial Here I've succefully convert the drop list into checkboxes.

 

This application submites the data into a SP list, in that list there are durations columns (duration 1, duration 2 ...etc.)

 

The next step is that I want submit button to update the durations column per chosen columns; for example if the user chose "3 months & 6 months", either the 1st and the 2nd columns are updated or the 3 months & 6 months columns will be updated with a date with 3 months in advance and 6 months in advance from the chosen "incubation date".

 

What I used to do before is to update the future date for 1 time period (as the gif attached) using the following:-

 

Table( { Name: "1 Week", Days: 7 },
{ Name: "2 Weeks", Days: 14 },
{ Name: "1 Month", Days: 30 },
{ Name: "2 Months", Days: 60 },
{ Name: "3 Months", Days: 90 },
{ Name: "6 Months", Days: 180 },
{ Name: "9 Months", Days: 270 },
{ Name: "12 Months", Days: 365 },
{ Name: "24 Months", Days: 730 },
{ Name: "36 Months", Days: 1095 } )

 

And the following formula in the Update field in the data picker

 

DateValue2.SelectedDate + Time(Value(HourValue2.SelectedText.Value), Value(MinuteValue2.SelectedText.Value), 0)

 

 

Now I don’t care showing the future date but I want when the user choses 3 periods, 3 dates will be updated in the SP list.

 

25 REPLIES 25

@WarrenBelz 

 

Happy Easter 🙂 

 

I've tried to recreate the pages again in case there was an error from something, but unfortunately, still it doesn't patch to the list :S 

@amralomari ,

This was not straight-forward (nearly raised the white flag a couple of times), but I have this working - firstly, you had two reserved words in your combo box, so I used this

Table(
    {Period: "1 Week", Span: 7},
    {Period: "2 Weeks", Span: 14},
    {Period: "1 Month", Span: 30},
    {Period: "2 Months", Span: 60},
    {Period: "3 Months", Span: 90},
    {Period: "6 Months", Span: 180},
    {Period: "9 Months", Span: 270},
    {Period: "12 Months", Span: 365},
    {Period: "24 Months", Span: 730},
    {Period: "36 Months", Span: 1095}
)

then your collect code

With(
   {
      wDays: 
      AddColumns(
         ComboBox2.SelectedItems,
         "AddDays",
         Value(Span)
      ),
      wDate: DateValue2.SelectedDate
   },
   ForAll(
      wDays,
      Patch(
         'Stability Conditions',
         Defaults('Stability Conditions'),
         {
            'Incubation Date': wDate,
            'Stability Conditions': 
            DateAdd(
               wDate,
               AddDays,
               Days
            )
         }
      )
   )
)

 

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.

 

amralomari
Helper III
Helper III

🎉🎊

It did finally work 

 

Thanks a lot, sir.

 

Best wishes to you.

Greetings sir 🙂 

 

I've faced an issue when trying to update an existing item through EditForm since the updated item became a completely new item 😅 

I've tried Replacing 

patch

with 

Update

with no luck!

 

Also tried adding 

 Patch(
            'Products List',
            Defaults('Products List'),
            LookUp('Products List',ID = Gallery1.Selected.ID),

with no luck!

 

any suggestions, please? 

@amralomari ,

You need to remove the Defaults('Product List') line and just have this

Patch(
   'Products List',
   {ID = Gallery1.Selected.ID},

 

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

amralomari
Helper III
Helper III

Thanks a lot 😃

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (4,415)