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

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
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.

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