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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

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