# Dynamic list of Days, Weeks, and Months for building Relations

**URL:** <https://community.glideapps.com/t/dynamic-list-of-days-weeks-and-months-for-building-relations/77601>\
**Category:** Ask for Help\
**Created:** [November 4, 2024, 11:09am UTC](https://community.glideapps.com/t/dynamic-list-of-days-weeks-and-months-for-building-relations/77601 "2024-11-04T11:09:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![matt45](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/matt45/32/58759_2.png) [@matt45](https://community.glideapps.com/u/matt45)\
**Post date:** [November 4, 2024, 11:09am UTC](https://community.glideapps.com/t/dynamic-list-of-days-weeks-and-months-for-building-relations/77601/1 "2024-11-04T11:09:48Z")

</div>

Hello all,

In my app (100% Glide Table) have a table of logs that I want to create relations with so that have tables I can build charts off of.

In a [previous post](https://community.glideapps.com/t/migrating-from-google-sheets-how-to-create-and-sort-a-unique-list-in-glide-tables/73877) @ThinhDinh helped me create a list of Mondays utilizing the “Row ID + lookup\_Row ID + Find Element Index + Math” strategy.

**Question #1** : I currently have 156 rows and being that there’s 52 weeks per year that means this will cover me for 3 years. This strategy is fine, I’ll just need to remember to add more rows later. I suppose I could add 1000 rows which would cover me for the next 20 years. Is there a way to make this list truly dynamic?

 ![Screenshot 2024-11-04 at 6.13.38 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/7/b7e692c38d86153e03494f03bd98e35b365b8255.jpeg)

**Question #2** : I want to make a similar table for Days. The method for Weeks would work, but it would just require 365 rows per year. Is there a better way to go about this?

**Question #3** : The real help I need is with Months. This one is throwing me for a loop. I’m read other posts relating to working with months but I haven’t read anything that I have been able to apply to my scenario. That doesn’t mean a solution isn’t out there, it just means **I** haven’t been able to find a solution. The approach for Weeks works by using a Math column with “currentMonday - Index\*7” to generate the list of Mondays. But Months are wonky and don’t play nicely because some months are 31, 30, 28, or 29 days.

@Jeff_Hager’s method in [this post](https://community.glideapps.com/t/if-then-else-with-date/11328/24) might be of use to me, but I’m not sure how to get the months to dynamically descend like I did for Weeks.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [November 4, 2024, 11:17am UTC](https://community.glideapps.com/t/dynamic-list-of-days-weeks-and-months-for-building-relations/77601/2 "2024-11-04T11:17:25Z")

</div>

> [@matt45](#):
>
> **Question #1** : I currently have 156 rows and being that there’s 52 weeks per year that means this will cover me for 3 years. This strategy is fine, I’ll just need to remember to add more rows later. I suppose I could add 1000 rows which would cover me for the next 20 years. Is there a way to make this list truly dynamic?

Do you need this to go on indefinitely, or could you limit it to X number of weeks?  
If you can set a limit, then yes it’s possible to set it up in such a way that the oldest week drops off the list as each new week rolls over.

> [@matt45](#):
>
> **Question #2** : I want to make a similar table for Days. The method for Weeks would work, but it would just require 365 rows per year. Is there a better way to go about this?

Same question as above, I think. The answer mostly depends on how you’re using the data and the maximum number of days you’d ever want to have visible at once.

> [@matt45](#):
>
> **Question #3** : The real help I need is with Months. This one is throwing me for a loop. I’m read other posts relating to working with months but I haven’t read anything that I have been able to apply to my scenario. That doesn’t mean a solution isn’t out there, it just means **I** haven’t been able to find a solution. The approach for Weeks works by using a Math column with “currentMonday - Index\*7” to generate the list of Mondays. But Months are wonky and don’t play nicely because some months are 31, 30, 28, or 29 days.

Yeah, this one is tricky. I do have a solution for this that involves a bit of fancy math and other data editor logic, but I can’t get at it right now. If nobody else offers up a solution I can provide it later.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [November 4, 2024, 11:46pm UTC](https://community.glideapps.com/t/dynamic-list-of-days-weeks-and-months-for-building-relations/77601/3 "2024-11-04T23:46:14Z")

</div>

> [@matt45](#):
>
> **Question #1** : I currently have 156 rows and being that there’s 52 weeks per year that means this will cover me for 3 years. This strategy is fine, I’ll just need to remember to add more rows later. I suppose I could add 1000 rows which would cover me for the next 20 years. Is there a way to make this list truly dynamic?

Same thoughts as Darren above, if you want to drop off old weeks, you can have a setup so that the 1st row moves along with real time, and that will move the latter rows as well.

> [@matt45](#):
>
> **Question #3** : The real help I need is with Months. This one is throwing me for a loop. I’m read other posts relating to working with months but I haven’t read anything that I have been able to apply to my scenario. That doesn’t mean a solution isn’t out there, it just means **I** haven’t been able to find a solution. The approach for Weeks works by using a Math column with “currentMonday - Index\*7” to generate the list of Mondays. But Months are wonky and don’t play nicely because some months are 31, 30, 28, or 29 days.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/8/68c70e292028b014328c965242608f0f3ad5508e.png)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/0/7011b393951b18f1f825135e97e4973c75b6390a.png)

```auto
N-DAY(N)+15+30*I-DAY(N-DAY(N)+15+30*I)+1

```

A bit of a same setup really.

---

<div class="post-metadata">

**Author:** ![matt45](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/matt45/32/58759_2.png) [@matt45](https://community.glideapps.com/u/matt45)\
**Post date:** [November 5, 2024, 7:09am UTC](https://community.glideapps.com/t/dynamic-list-of-days-weeks-and-months-for-building-relations/77601/4 "2024-11-05T07:09:56Z")

</div>

> [@Darren\_Murphy](#):
>
> Do you need this to go on indefinitely, or could you limit it to X number of weeks?  
> If you can set a limit, then yes it’s possible to set it up in such a way that the oldest week drops off the list as each new week rolls over.

> [@Darren\_Murphy](#):
>
> Same question as above, I think. The answer mostly depends on how you’re using the data and the maximum number of days you’d ever want to have visible at once.

Indefinite feels nice, because it is one less thing to worry about or keep track of, but in all actuality it probably isn’t necessary. It is more likely that the app or Glide will change before the finite number of rows I prepare are used up.

Days: 2 years \>\> 730 rows  
Weeks: 4 years \>\> 208 rows  
Months: 6 years. \>\> 72 rows  
Years: 10 years \>\> 10 rows

But nevertheless I’m curious about the solution if I did need to let it go on indefinitely. What would that be?

---

<div class="post-metadata">

**Author:** ![matt45](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/matt45/32/58759_2.png) [@matt45](https://community.glideapps.com/u/matt45)\
**Post date:** [November 5, 2024, 7:17am UTC](https://community.glideapps.com/t/dynamic-list-of-days-weeks-and-months-for-building-relations/77601/5 "2024-11-05T07:17:31Z")

</div>

> [@ThinhDinh](#):
>
> ```auto
> N-DAY(N)+15+30*I-DAY(N-DAY(N)+15+30*I)+1
> 
> ```
> 
> A bit of a same setup really.

Beautiful! Wow I like that. Thank you, @ThinhDinh!

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [November 5, 2024, 7:32am UTC](https://community.glideapps.com/t/dynamic-list-of-days-weeks-and-months-for-building-relations/77601/6 "2024-11-05T07:32:07Z")

</div>

> [@matt45](#):
>
> But nevertheless I’m curious about the solution if I did need to let it go on indefinitely. What would that be?

Well you’d just have to keep adding rows. You could use some sort of automation tool in conjunction with the API, but in this case it would probably be easier to just add them manually.

---

<div class="post-metadata">

**Author:** ![matt45](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/matt45/32/58759_2.png) [@matt45](https://community.glideapps.com/u/matt45)\
**Post date:** [November 5, 2024, 7:57am UTC](https://community.glideapps.com/t/dynamic-list-of-days-weeks-and-months-for-building-relations/77601/7 "2024-11-05T07:57:14Z")

</div>

Ah I see, the manual method does seem more appropriate for this case. Thank you!

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [November 12, 2024, 7:57am UTC](https://community.glideapps.com/t/dynamic-list-of-days-weeks-and-months-for-building-relations/77601/8 "2024-11-12T07:57:42Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
