# Error: item can not be added to more than one

**URL:** <https://community.fibery.io/t/error-item-can-not-be-added-to-more-than-one/5905>\
**Category:** Get Help\
**Created:** [February 24, 2024, 1:38pm UTC](https://community.fibery.io/t/error-item-can-not-be-added-to-more-than-one/5905 "2024-02-24T13:38:34Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![YvetteLans](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/yvettelans/32/6101_2.png) [@YvetteLans](https://community.fibery.io/u/YvetteLans)\
**Post date:** [February 24, 2024, 1:38pm UTC](https://community.fibery.io/t/error-item-can-not-be-added-to-more-than-one/5905/1 "2024-02-24T13:38:34Z")

</div>

Hi,

I have an automation that links an order to a campaign when the product + contact + date range matches.

An order can only be linked to one campaign.

When the product ID in the campaign is updated, the system searches for orders to link.

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

When all product ID’s are updated at the same time in the campaigns of a contact, I get this error in the automation that wants to link the order.

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

Which I can understand, since the order can only be linked to one campaign.

But the problem is that currently the order is linked to _none of the campaigns_ because of this error.

How can I achieve that the order will be linked to one? I prefer that the order gets linked to the last campaign (is the example above February 24) but that’s not a hard requirement.

Thanks!

---

<div class="post-metadata">

**Author:** ![YvetteLans](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/yvettelans/32/6101_2.png) [@YvetteLans](https://community.fibery.io/u/YvetteLans)\
**Post date:** [February 24, 2024, 2:07pm UTC](https://community.fibery.io/t/error-item-can-not-be-added-to-more-than-one/5905/2 "2024-02-24T14:07:33Z")

</div>

As a workaround I’ve created an extra many - many relation between campaign and order. Step 1 is that I link orders to all possible campaigns, step 2 is that I decide in the order to which (one) campaign it actually needs to be linked.

Feels a bit heavy but it works. If somebody has a better idea, please let me know 😄

---

<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:** [February 24, 2024, 2:59pm UTC](https://community.fibery.io/t/error-item-can-not-be-added-to-more-than-one/5905/3 "2024-02-24T14:59:49Z")

</div>

> [@YvetteLans](#):
>
> How can I achieve that the order will be linked to one? I prefer that the order gets linked to the last campaign (is the example above February 24) but that’s not a hard requirement.

What formula are you using to find the one to link?  
FWIW if the automation is running on a batch of Campaigns, I can’t think that there can be a way to choose a particular one for the Order to be linked to, since each Campaign in the batch is unaware of the other items in the batch, so there is no way for any Campaign to know if it has the latest date.

---

<div class="post-metadata">

**Author:** ![YvetteLans](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/yvettelans/32/6101_2.png) [@YvetteLans](https://community.fibery.io/u/YvetteLans)\
**Post date:** [February 24, 2024, 3:09pm UTC](https://community.fibery.io/t/error-item-can-not-be-added-to-more-than-one/5905/4 "2024-02-24T15:09:19Z")

</div>

> [@Chr1sG](#):
>
> What formula are you using to find the one to link?

I’ve already deleted the formula, but I’ve searched for orders

- with no campaign activity
- same contact
- and date that matches the criteria (only orders of last 7 days can be linked)

If a contact opened 5 campaigns and those campaigns all get updated at the same time (because a user linked a product to those campaign) then the error occurred.

> [@Chr1sG](#):
>
> I can’t think that there can be a way to choose a particular one for the Order to be linked to, since each Campaign in the batch is unaware of the other items in the batch, so there is no way for any Campaign to know if it has the latest date.

Yes that wasn’t possible when I start the automation in the campaign database.

But it is possible if I do it in the order database.

> [@YvetteLans](#):
>
> Step 1 is that I link orders to all possible campaigns, step 2 is that I decide in the order to which (one) campaign it actually needs to be linked.

Because in a order I can filter and sort the campaigns on last campaign date.

```auto
[Campagne activiteits]
  .Filter(
    Find([Product ID], [Step 1 Order].[Product ID]) > 0 and
      [Datum laatste activiteit] >= [Step 1 Order].Datum - Days(7) and
      [Datum laatste activiteit] <= [Step 1 Order].Datum and
      [Step 1 Order].Contact = Contact
  )
  .Sort([Datum laatste activiteit])
  .Last()

```

So this workaround actually works pretty well 😄 I did a stress test with tons of campaigns + orders and the correct ones are linked now.

---

<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:** [February 24, 2024, 3:28pm UTC](https://community.fibery.io/t/error-item-can-not-be-added-to-more-than-one/5905/5 "2024-02-24T15:28:13Z")

</div>

> [@YvetteLans](#):
>
> Yes that wasn’t possible when I start the automation in the campaign database.
> 
> But it is possible if I do it in the order database

I assumed that this wasn’t possible since you wrote this:

> [@YvetteLans](#):
>
> I have an automation that links an order to a campaign when the product + contact + date range matches.

and I thought that meant it needed to be triggered in the Campaign db.

Anyway…

> [@YvetteLans](#):
>
> So this workaround actually works pretty well 😄 I did a stress test with tons of campaigns + orders and the correct ones are linked now.

Sounds good 😊

---

<div class="post-metadata">

**Author:** ![YvetteLans](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/yvettelans/32/6101_2.png) [@YvetteLans](https://community.fibery.io/u/YvetteLans)\
**Post date:** [February 24, 2024, 3:33pm UTC](https://community.fibery.io/t/error-item-can-not-be-added-to-more-than-one/5905/6 "2024-02-24T15:33:08Z")

</div>

> [@Chr1sG](#):
>
> and I thought that meant it needed to be triggered in the Campaign db.

Yes it needs to get triggered in the campaign database. But because of the extra relation with order (‘link all possible orders’) I can still manage it via order database (‘when possible campaigns are linked, then search for the best campaign to link to’) 😄

However, it seems there is another problem.

If the campaign has product ID [1] [2] and the order has [2] [3] the orders are not linked correctly.

I was hoping that it still finds a match because [2] is present in both strings, but it seems that’s not the case?

---

<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:** [February 24, 2024, 3:52pm UTC](https://community.fibery.io/t/error-item-can-not-be-added-to-more-than-one/5905/7 "2024-02-24T15:52:37Z")

</div>

> [@YvetteLans](#):
>
> If the campaign has product ID [1] [2] and the order has [2] [3] the orders are not linked correctly.
> 
> I was hoping that it still finds a match because [2] is present in both strings, but it seems that’s not the case?

Indeed. Comparing two collections to see what entities they have in common (or comparing two strings to see of they have any degree of ‘overlap’) is not possible as far as I know.

Still waiting on _union_ and _intersection_ functions 😕

> [@How to union two list fields in the same Database?](https://community.fibery.io/t/how-to-union-two-list-fields-in-the-same-database/2467):
>
> I have two list fields in my Database: Tags and [Project Tags]. (Tags is an x:many relation and [Project Tags] is a lookup of an x:many field.) I want to combine them into a single list field [All Tags], so if (eg) Tags = (foo, bar) and [Project Tags] = (baz, bam) then [All Tags] = (foo, bar, baz, bam). Is this possible? I can’t figure out how to do it with a formula or a lookup. Extra complication: ultimately I actually want the unique set of all tags, so if (eg) Tags = (foo, bar) and [Pro…

---

<div class="post-metadata">

**Author:** ![YvetteLans](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/yvettelans/32/6101_2.png) [@YvetteLans](https://community.fibery.io/u/YvetteLans)\
**Post date:** [February 24, 2024, 5:35pm UTC](https://community.fibery.io/t/error-item-can-not-be-added-to-more-than-one/5905/8 "2024-02-24T17:35:22Z")

</div>

> [@Chr1sG](#):
>
> Indeed. Comparing two collections to see what entities they have in common (or comparing two strings to see of they have any degree of ‘overlap’) is not possible as far as I know.

Noooooo 😅 that’s real f\*cked up 🤯

> [@Chr1sG](#):
>
> Still waiting on _union_ and _intersection_ functions 😕

Is this a complex change?
