Insert all dates between a start and end date input

Hi All,

I’m trying to figure out some queries i need to write to insert some data into my database.

What is the best way to go about inserting a row for each date between a user defined start and end date (based on a submitting a form)?

I’m getting better with Wappler and SQL, but have yet to really use any of the WHILE or even REPEAT functions (apart from creating a nested table as per the documents)

End result would like basically like this (minus other info not relevant)

image

Help in the right direction would be appreciated.

Ok. So for what its worth i have managed to figure this out at a basic level using Session variables of my Post variables and the WHILE function as per a post i saw on here.

Not sure if this is the best way, but for now it is working.

2 Likes

Hi Philip,
That is indeed a nice solution and a nice example of using the while component in server connect :slight_smile: You can also use set value steps, instead of sessions :slight_smile:

Great to see you found out yourself how to achieve this.

Hi @Teodor ,

Should this same process work with a Time variable/session?

I am needing to do the same thing but have a start and end time that repeats and adds a record for every 15 minute interval. I have gotten the ‘date add’ minutes/15 to work for one record, but when used inside an identical set up to the above process it does not repeat a record for every 15 minutes between the start and end times.

Its like this currently… all variables are type Time. It works on 1 record, but doesn’t loop through and add the ‘date add - 15 minutes’

Should it work the same in theory? Or am i doing something wrong when it comes to time?