# Create a formule to link to a database with a one to many relationship

**URL:** <https://community.fibery.io/t/create-a-formule-to-link-to-a-database-with-a-one-to-many-relationship/3679>\
**Category:** Get Help\
**Created:** [December 9, 2022, 1:18pm UTC](https://community.fibery.io/t/create-a-formule-to-link-to-a-database-with-a-one-to-many-relationship/3679 "2022-12-09T13:18:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marloes](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/marloes/32/5926_2.png) [@Marloes](https://community.fibery.io/u/Marloes)\
**Post date:** [December 9, 2022, 1:18pm UTC](https://community.fibery.io/t/create-a-formule-to-link-to-a-database-with-a-one-to-many-relationship/3679/1 "2022-12-09T13:18:35Z")

</div>

Hi,

I want to create an automation to link a product (from a product database) to an _orderregel_. Don’t want to use the autolink option, but with a formula inside an automation instead.

The automation I’m willing to use (inside _orderregels_) is:

- If order is created
- Then link to product, with formula: _Products.Filter(Find([Step 1 Orderregel].Name,Name) \> 0)_

But I’ve discovered that I’m not able to use this formula using a one-many relationship. If I change the relation in a many-many relationship it works.

In our case a _Orderregel_ can never contains more than one product. But a product can have many _orderregels_.

Changing the relation to many to many would solve the issue with the formula, but I’m curious to find out why it’s not working using a one-many relationship. And whether or not there may be a different formula which makes it possible to map if name **contains** in A - link it to a product that **contains** the same.

Thanks!

---

<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:** [December 9, 2022, 4:25pm UTC](https://community.fibery.io/t/create-a-formule-to-link-to-a-database-with-a-one-to-many-relationship/3679/3 "2022-12-09T16:25:59Z")

</div>

`Products.Filter(Find([Step 1 Orderregel].Name,Name) > 0)`

will return a collection of Products that meet the filter criteria. If you know there is only one such Product, you will need to explicitly choose it using

`Products.Filter(Find([Step 1 Orderregel].Name,Name) > 0).Sort().First()`

---

<div class="post-metadata">

**Author:** ![Marloes](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/marloes/32/5926_2.png) [@Marloes](https://community.fibery.io/u/Marloes)\
**Post date:** [December 9, 2022, 6:05pm UTC](https://community.fibery.io/t/create-a-formule-to-link-to-a-database-with-a-one-to-many-relationship/3679/4 "2022-12-09T18:05:01Z")

</div>

Ah cool! Same like we’ve had before! Will make a special note for this.

Thanks
