# Link entity within a date-range to other enity (year)

**URL:** <https://community.fibery.io/t/link-entity-within-a-date-range-to-other-enity-year/3991>\
**Category:** Get Help\
**Created:** [February 15, 2023, 6:42am UTC](https://community.fibery.io/t/link-entity-within-a-date-range-to-other-enity-year/3991 "2023-02-15T06:42:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris.burchartz](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chris.burchartz/32/662_2.png) [@chris.burchartz](https://community.fibery.io/u/chris.burchartz)\
**Post date:** [February 15, 2023, 6:42am UTC](https://community.fibery.io/t/link-entity-within-a-date-range-to-other-enity-year/3991/1 "2023-02-15T06:42:13Z")

</div>

I know that there are several workarounds out there to achieve this tasks but I was wondering if by now there was a direct way through automation and generic use of formula-code?

I want to link an entity A (`EVENTS`) to a parent entity B (table name `YEARS`).  
The matching criteria would be a single date field (A) which should be within a date-range (B).

**Example**  
The event “Christmas party” (Table A) has the date “24 Dez 2024”  
Table B holds several entities: 2022, 2023, 2024 - each entity with a date-range-field set to 01. Jan 20xx - 31. Dez 20xx  
I now want to link the EVENT “Christmas party” to the correct entity from YEARS (in this case the date-range-field set 01. Jan 2024 - 31. Dez 2024).

To me this looks like quite a common thing to do…

Looking forward to hearing some great ideas on how to do this (the easiest way) 🙂  
Christoph

---

<div class="post-metadata">

**Author:** ![Max](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/max/32/6063_2.png) [@Max](https://community.fibery.io/u/Max)\
**Post date:** [February 16, 2023, 7:13am UTC](https://community.fibery.io/t/link-entity-within-a-date-range-to-other-enity-year/3991/2 "2023-02-16T07:13:38Z")

</div>

Hi Christoph,  
you can achieve this with a formula and a auto-relation.

First, create a formula (let’s say Year) on the Event DB. Here, you need to extract the year from the date like so: Year(Date.Start).  
Now you can create a relation to the Year DB. When you do this, please select “Automatically link Events to Years”. Then select the Years Field of the Event DB and the (I guess) Name field of the Year DB.

E voilà, the events should be linked to the respective years automatically.

I hope this helps.

Max
