Showing results for 
Search instead for 
Did you mean: 
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.


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

DateDiff(DatePicker1_1.SelectedDate, DatePicker2_1.SelectedDate, Days) + 1
"Day" & (Value + 1),

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.

Helper I
Helper I

Are you already connected to your SQL table? 


If they are columns in a table, it would be easier to write 16 lines in a patch statement (provided the +days numbers are always the same) than try to transform a collection to patch. 

Helper II
Helper II

Hello berofeev,


Can you give me an example with the source above? The columns are Date, Date2, Date3 etc.



Helper I
Helper I

I'll try to get to it later today. I'm on mobile right now and am having trouble understanding your collect statement on this small screen. 


Helper II
Helper II

I have the code from this site

and modified it for my dates formula


Helper I
Helper I

Ok, assuming your table name is "cycle", your patch would look like the following:


    Date: DatePicker1_1.SelectedDate,
    Date2: DateAdd(DatePicker1_1.SelectedDate, 1, Days),
    Date3: DateAdd(DatePicker1_1.SelectedDate, 14, Days),
    Date4: DateAdd(DatePicker1_1.SelectedDate, 15, Days),
    Date5: DateAdd(DatePicker1_1.SelectedDate, 28, Days),
    Date6: DateAdd(DatePicker1_1.SelectedDate, 29, Days)


Another note: I am not sure if you are working with an existing legacy database or designing your own from scratch, but if you are designing from scratch I would caution against the idea of having Date, Date2, Date3 etc... columns.


You would be better off having a related table with date records, and referencing it instead.  As devs though, we don't always get the luxury of designing the underlying data ourselves though...







Hi Brendan, Thanks for your answer and help.
Where can I use the patch command in my source? Or should there be a separate button for this?

Hi @rvdhorst,

Without understanding the full breadth of what you are trying to achieve and what you've built its hard to say where to use it.


A simple solution would be a button thiugh. Place it in the OnSelect property for the button. 




Community Support
Community Support

Hi @rvdhorst ,


I agree with @rvdhorst .

I don't recommend you to create too many columns.

If you create too many columns, although you can save a lot of information in a record, the canvas formula will be very redundant. And this will affect performance.

If you don’t want to modify your data source, I will make a demo for you based on the collection.


// My datasource 




// My collection 


Add another button and set its Items property to:






Best Regards,






Hi Brendan,

What I want to achieve is when a start date is chosen that it is written to a SQL database cycle with columns Date1, Date2, Date3, Date4.

For example, if the user chooses the date 12/07/2021 that date will be written to Date1, 12/8/2021to Date2 , 12/12/2021 to Date3 , and 12/22/2021 to Date4 .


If the User chooses a different start date, other dates will of course result. Is this easier to make than the way I do this?

Helpful resources

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.


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,051)