Forum Discussion
FrancescoSpiga
3 years agoQrew Member
I probably should have clarified earlier in my 1st message :( sorry...
I am trying to loop through those 2 dates and create new records for all the dates in between them.
Example: 8-23-2022, 8-27-2022
This will create 5 records in a new table (8/23,8/24,8/25,8/26,8/27)
How would you manage this use case via pipelines?
------------------------------
Francesco Spiga
------------------------------
I am trying to loop through those 2 dates and create new records for all the dates in between them.
Example: 8-23-2022, 8-27-2022
This will create 5 records in a new table (8/23,8/24,8/25,8/26,8/27)
How would you manage this use case via pipelines?
------------------------------
Francesco Spiga
------------------------------
KristofferKeen1
3 years agoQuickbase Staff
Oh that makes more sense!
I recommend creating a "template days" table with every date listed 1/1/22, 1/2/22, 1/3/22 all the through say ....12/30/2030, 12/31/2030 (Feel free to go farther in time, but at any rate, I would create a quick excel table to list all the dates and import them to your template table)
...
From there when your pipeline is triggered, you could search through all the records in between the 2 dates, I believe the Query with Date "is between" includes your two dates
Then have the pipeline create a new record for every date that it finds. That's the short of it.
However, even more efficient would create a bulk upsert, which is probably what you were originally thinking in this thread. So when all the dates are found in between and added to your bulk upsert, then you commit the upsert/import all of your dates. See screenshot below for a list of your steps:
Hope that helps even more :)
-Kris
------------------------------
Kristoffer Keene
------------------------------
I recommend creating a "template days" table with every date listed 1/1/22, 1/2/22, 1/3/22 all the through say ....12/30/2030, 12/31/2030 (Feel free to go farther in time, but at any rate, I would create a quick excel table to list all the dates and import them to your template table)
...
From there when your pipeline is triggered, you could search through all the records in between the 2 dates, I believe the Query with Date "is between" includes your two dates
Then have the pipeline create a new record for every date that it finds. That's the short of it.
However, even more efficient would create a bulk upsert, which is probably what you were originally thinking in this thread. So when all the dates are found in between and added to your bulk upsert, then you commit the upsert/import all of your dates. See screenshot below for a list of your steps:
Hope that helps even more :)
-Kris
------------------------------
Kristoffer Keene
------------------------------
- PrashantMaheshw3 years agoQrew CaptainKris, This idea of doing Add a bulk upset in a loop and then committing upsert outside the loop is genius !
------------------------------
Prashant Maheshwari
------------------------------ - FrancescoSpiga3 years agoQrew Member
Thanks for the suggestions/ideas!
I ended up going with the "Find All Matched to a Regex"
I built a formula field referencing the table with the calendar days, which I already had.
Anyway, I am very glad I run into this post!
Have a great day!
------------------------------
Francesco Spiga
------------------------------ - DougHenning13 years agoCommunity Manager
You can also use Jinja to create the dates in between a start and end date:
{% set startDate = "08/25/2022" %} {% set endDate = "09/05/2022" %} {% set days = ((time.parse(endDate) - time.parse(startDate))|string).split(' ')[0]|int %} {% for x in range(days+1) %}{{ (time.parse(startDate) + time.delta(days=x))|date_mdy}};{% endfor %}
Then use the Regex step to create a list you can iterate:
Hope that's helpful!
------------------------------
Doug Henning
------------------------------