# Enumeration of sequential entities

**URL:** <https://community.fibery.io/t/enumeration-of-sequential-entities/3037>\
**Category:** Ideas & Features\
**Created:** [July 5, 2022, 7:48pm UTC](https://community.fibery.io/t/enumeration-of-sequential-entities/3037 "2022-07-05T19:48:13Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mikkling](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Mikkling](https://community.fibery.io/u/Mikkling)\
**Post date:** [July 5, 2022, 7:48pm UTC](https://community.fibery.io/t/enumeration-of-sequential-entities/3037/1 "2022-07-05T19:48:13Z")

</div>

**My problem**  
I have a DB of weeks, all of which are in date sequence. I want to have a window of 4 weeks (tagged as Last week, This week, Next week, 2nd next) that automatically updates every Monday. The point is to link tasks to weeks, and lookup the week tag, allowing us to have a kanban board of tasks for these 4 weeks and to autobump this weeks’ unfinished tasks to next week.

This would be easy to implement if Fibery could enumerate entities in a DB given a sorting field…

**My solution**  
I copy-pasted a sequence of numbers as a numbers field named idnum to serve as a numeric ID. I added a formula field named prevnum with a value of idnum-1. This allows me to autolink weeks where idnum == prevnum, enabling me to find the previous and next weeks for an arbitrary week. And with three automations

1. Find the current week and tag it, the previous week, and the next accordingly
2. Clear the tag for the previous week’s previous week
3. Find the week tagged “Next week” and tag its next week “2nd next”

I have my automoving 4-week window.

**My request**  
Make Fibery aware of sequences, and implement next() and prev() functions or allow next and previous entities to be autolinked.

Even better, implement entity-level named links; this would allow a primitive graph traversal.

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [July 5, 2022, 9:36pm UTC](https://community.fibery.io/t/enumeration-of-sequential-entities/3037/2 "2022-07-05T21:36:21Z")

</div>

Hi @Mikkling  
I think there might be some clever tricks you can use to make things easier/simpler, but before I suggest them, can I check something: what fields does a Week entity have (apart from the one(s) you added to get the sequence working)?  
I might guess that a date field is one of them (Start Date perhaps?)

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [July 5, 2022, 9:39pm UTC](https://community.fibery.io/t/enumeration-of-sequential-entities/3037/3 "2022-07-05T21:39:16Z")

</div>

Also, can you explain what

> [@Mikkling](#):
>
> entity-level named links

means and/or would entail…

---

<div class="post-metadata">

**Author:** ![Mikkling](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Mikkling](https://community.fibery.io/u/Mikkling)\
**Post date:** [July 5, 2022, 10:11pm UTC](https://community.fibery.io/t/enumeration-of-sequential-entities/3037/4 "2022-07-05T22:11:31Z")

</div>

I’m actually using the Dates template space you posted a while back, and the weeks are the year-week DB from that template.

Also, “entity-level named links” is just my wish for graph DB edges in Fibery. Now that i think about it, i realize that those would not mean much without the power of a graph query language that can leverage them.

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [July 6, 2022, 7:54am UTC](https://community.fibery.io/t/enumeration-of-sequential-entities/3037/5 "2022-07-06T07:54:53Z")

</div>

In that case, here’s what I would do:

- create a Tag database (with entities Last week, This week, Next week and 2nd week)
- add a number field called Offset and set the value to the number of days difference from today (e.g. -7, 0, +7, +14)
- use a formula field to get a date based on the offset:  
`Today() + Days(Offset)`
- add an auto-relation field to get the matching Date entity (i.e. link to the Date database in the template I shared):  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/5/5251213c32f2c788ebf1c63faacf87b87ca41298.png)

You should end up with something like this:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/d/db311341dab34d2e2b4bfc9b7ab80f536db821bb.png)

- now use a lookup to in the YW database to get the any Tag from the Dates in that week:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/f/f5cf210da698b99abfce9e20da330139e7b1fe36.png)

Now, there should be 4 specific weeks (entities in the YW database) that have a Tag associated with them, and you can use these in the views as you need (e.g. as columns in a board view, as filters, etc.)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/d/dca039febdbff01e7436b0ac49aaf2c5292134e7.png)

---

<div class="post-metadata">

**Author:** ![Mikkling](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Mikkling](https://community.fibery.io/u/Mikkling)\
**Post date:** [July 6, 2022, 9:00am UTC](https://community.fibery.io/t/enumeration-of-sequential-entities/3037/6 "2022-07-06T09:00:39Z")

</div>

> [@Chr1sG](#):
>
> use a formula field to get a date based on the offset:  
> `Today() + Days(Offset)`

Cool, thanks! And to make the week tags autoupdate, i’d change the formula field to a regular date field and update those dates with an automation, right?

I still think Fibery needs a way to sort and enumerate entities. Perhaps i should just learn javascript…

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [July 6, 2022, 9:02am UTC](https://community.fibery.io/t/enumeration-of-sequential-entities/3037/7 "2022-07-06T09:02:17Z")

</div>

The week tags will auto-update if set up like I describe.  
This is because the calculated Date field in the Tag database will change every day, and this will change the auto-related Linked date, and this will be reflected in the lookup.  
No automations needed! 🙂

---

<div class="post-metadata">

**Author:** ![Mikkling](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Mikkling](https://community.fibery.io/u/Mikkling)\
**Post date:** [July 6, 2022, 10:29am UTC](https://community.fibery.io/t/enumeration-of-sequential-entities/3037/8 "2022-07-06T10:29:10Z")

</div>

Seriously? I thought all functions in formula fields were passive. The information that Today() automatically runs itself should definitely go in the Formulas Reference!

Is that why Now() is not available in formula fields?

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [July 6, 2022, 11:12am UTC](https://community.fibery.io/t/enumeration-of-sequential-entities/3037/9 "2022-07-06T11:12:01Z")

</div>

So yes, Today() will return the current date (which will be a different value tomorrow than it is today) so in that sense it ‘runs automatically’.  
Perhaps our user guide should be more explicit about this.

And correct, we can’t allow Now() in formula fields, since it would recalculate every second.  
Note that we do allow it in the formula fields for automation actions, since in that situation it is calculated once and used.

---

<div class="post-metadata">

**Author:** ![aoe](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/aoe/32/6018_2.png) [@aoe](https://community.fibery.io/u/aoe)\
**Post date:** [January 8, 2023, 10:31am UTC](https://community.fibery.io/t/enumeration-of-sequential-entities/3037/10 "2023-01-08T10:31:43Z")

</div>

Hi @Chr1sG!

Would you mind sharing the Dates DB again?

I have a similar use case and would like to see how you’ve set it up.

---

<div class="post-metadata">

**Author:** ![aoe](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/aoe/32/6018_2.png) [@aoe](https://community.fibery.io/u/aoe)\
**Post date:** [January 8, 2023, 11:12am UTC](https://community.fibery.io/t/enumeration-of-sequential-entities/3037/11 "2023-01-08T11:12:17Z")

</div>

I think I found it, for anyone else looking.

> [@Template for date grouping](https://community.fibery.io/t/template-for-date-grouping/2678):
>
> UPDATE: this (static) template is being superseded by an integration template: At the moment, Fibery only natively supports the standard date field, which requires the user to pick the day, month and year. Sometimes it’s useful to deal with time periods other than just dates, e.g. what if you want to do some high-level planning, assigning projects to a specific quarter? or maybe you log activity month by month? Here’s a template that might make things easier for you: '[Dates — Fibery](https://shared.fibery.io/t/10fe601d-d5da-406f-a775-197ea8a70b56-dates) It …
