cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rvdhorst
Helper II
Helper II

Collection to SQL and sum dates.

Hi Allen,

How can I manage if I have a start date (date picker) and must be added to this.

For example my first date is 12/07/2021. After this, the following dates should be generated automatically.

07-12-2021
08-12-2021
21-12-2021
22-12-2021
04-01-2022
05-01-2022


So first + 1 day then +14, days. then again + 1 day and again 14, etc. and that in a set of 16x (see picture)

I have the following Collection

ClearCollect(
DateRanges,
AddColumns(
firstN(
[0,1,14,15,28,29,42,43,56,57,70,71,84,85,98,99],
DateDiff(DatePicker1_1.SelectedDate, DatePicker2_1.SelectedDate, Days) + 1
),
"day",
"Day" & (Value + 1),
"date",

DateAdd(DatePicker1_1.SelectedDate, Value, Days)

)

)


My question is how can I write the dates in a SQL database.
Database is called cycle
Date column fields are, date1, date2, date3 to date16


Hope you can help me.

10 REPLIES 10

Hi @rvdhorst,

 

You're going about it the right way for your purpose. 

 

In the button OnSelect I would also add a Notify("Dates added") so the user knows it has worked. Without a confirmation they might press the button multiple times and add multiple sets of records.

 

Finally, you might want to wrap your Patch() in an IfError() so you can control what happens if the patch doesn't work properly.

 

Good luck with your project! 

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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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
Users online (2,023)