Enumeration of sequential entities

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.

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?)

1 Like

Also, can you explain what

means and/or would entail…

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.

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):

You should end up with something like this:

  • now use a lookup to in the YW database to get the any Tag from the Dates in that week:

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.)

1 Like

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…

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! :slight_smile:

1 Like

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?

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.

1 Like