# Multi-reference - Feedback and question

**URL:** <https://community.appfarm.io/t/multi-reference-feedback-and-question/1159>\
**Category:** Ask the community\
**Created:** [April 12, 2024, 6:25am UTC](https://community.appfarm.io/t/multi-reference-feedback-and-question/1159 "2024-04-12T06:25:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeremy.jean](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/jeremy.jean/32/123_2.png) [@jeremy.jean](https://community.appfarm.io/u/jeremy.jean)\
**Post date:** [April 12, 2024, 6:25am UTC](https://community.appfarm.io/t/multi-reference-feedback-and-question/1159/1 "2024-04-12T06:25:22Z")

</div>

Hello, I just tested the new released mutli-reference feature, and I have a couple of questions. My assumption here is that I have an **Item** object class and a **Selection** object class that reference this item as multireference (meaning that one selection can have multiples items). In the app, I listed the items (in an iterative object) and when clicking on it, it’s adding the item into the selection (object Selection cardinality one in the datasource)

- To add an item into my selection, I didn’t find any way to go to a function and use array.push to add the \_id of my object, is there any other better approach ?
- To remove an item, it’s the same, need to use a function to remove a specific item from the list
- last but not least, the attribute “items” from my selection is not exposed into graphQL (or, not yet 😉 )

Note that I wanted to keep it simple without creating too many runtime datasource

---

<div class="post-metadata">

**Author:** ![jeremy.jean](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/jeremy.jean/32/123_2.png) [@jeremy.jean](https://community.appfarm.io/u/jeremy.jean)\
**Post date:** [April 12, 2024, 6:41am UTC](https://community.appfarm.io/t/multi-reference-feedback-and-question/1159/2 "2024-04-12T06:41:38Z")

</div>

**Erratum**  
Working with an additionnal Runtime (cardinality many, object class item) to reference the list of items of my selected selection makes things a bit easier, but still need to use two “steps” to add an item in the list:

- first add the item into that Runtime items (for selected selection)
- update the list of items into the selection with all value of the runtime

---

<div class="post-metadata">

**Author:** ![kristian](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/kristian/32/58_2.png) [@kristian](https://community.appfarm.io/u/kristian)\
**Post date:** [April 12, 2024, 6:49am UTC](https://community.appfarm.io/t/multi-reference-feedback-and-question/1159/3 "2024-04-12T06:49:04Z")

</div>

Hi Jeremy!

Regarding the first two points: Does the key feature number 2 (“add/remove ids”) help? You can use the Value Processor in an Update Object, as in the linked example in bullet # 2 in the below link.

> **[Many-to-many relationships | Appfarm Documentation](https://docs.appfarm.io/how-to/data-modeling/many-to-many-relationships#multi-reference-key-features)**

I am not sure about the GraphQL part - will come back with an answer on that!

---

<div class="post-metadata">

**Author:** ![kristian](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/kristian/32/58_2.png) [@kristian](https://community.appfarm.io/u/kristian)\
**Post date:** [April 12, 2024, 7:27am UTC](https://community.appfarm.io/t/multi-reference-feedback-and-question/1159/4 "2024-04-12T07:27:27Z")

</div>

A quick update on this one:

1. There guide is correct regarding adding or removing items in the multi-ref list, but there is a bug when you try to clear/remove the last item. Will be patched soon.
2. GraphQL: If you have the multiref property `tags` it currently does not appear if you try to list `{persons}` in GraphQL. This challenge is registered. You must currently specify the name of the property (`tags`) in the list of properties to return, e.g. `{persons {_id, tags}}`

---

<div class="post-metadata">

**Author:** ![jeremy.jean](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/jeremy.jean/32/123_2.png) [@jeremy.jean](https://community.appfarm.io/u/jeremy.jean)\
**Post date:** [April 12, 2024, 7:33am UTC](https://community.appfarm.io/t/multi-reference-feedback-and-question/1159/5 "2024-04-12T07:33:26Z")

</div>

Hi Kristian, thanks a lot for the quick answer, and sorry for asking something that was clearly mentionned in the doc.  
I went too fast in the **update object** doc (maybe because the _Multi cardinaliy - Value processor_ tab is not shown by default, but I actually have no other good excuse ^^)

So it actually working fine like described with the Value processor (add/remove).  
Good to know that it’s already available in GraphQL !  
So far so good ! Validated new feature !

---

<div class="post-metadata">

**Author:** ![Johan18](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/johan18/32/748_2.png) [@Johan18](https://community.appfarm.io/u/Johan18)\
**Post date:** [April 12, 2024, 9:28am UTC](https://community.appfarm.io/t/multi-reference-feedback-and-question/1159/6 "2024-04-12T09:28:59Z")

</div>

Ah. I struggle very hard with deleting the last reference… so waiting for the fix.

---

<div class="post-metadata">

**Author:** ![Johan18](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/johan18/32/748_2.png) [@Johan18](https://community.appfarm.io/u/Johan18)\
**Post date:** [April 29, 2024, 10:28am UTC](https://community.appfarm.io/t/multi-reference-feedback-and-question/1159/7 "2024-04-29T10:28:30Z")

</div>

Hi  
There is another bug in multi reference.  
a product has product\* as reference. When clicking on a product I add it to the product\* field, by referencing the product(temp)-products\* → add selection (product). This unfortunately only works if there are already at least one product referenced, but not if there are no products in the field.

Therefore I need a workaround that checks if empty. If empty I just reference the product (Context), if it is NOT emtpy I take the current value (product temp - products) and add selection (product).

Similar as the problem with deleting the last, just the opposite way.

---

<div class="post-metadata">

**Author:** ![kristian](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/kristian/32/58_2.png) [@kristian](https://community.appfarm.io/u/kristian)\
**Post date:** [April 29, 2024, 12:39pm UTC](https://community.appfarm.io/t/multi-reference-feedback-and-question/1159/8 "2024-04-29T12:39:28Z")

</div>

Thanks,

Can you provide a few screenshots of the setup to make sure we can reproduce it equally?

---

<div class="post-metadata">

**Author:** ![Johan18](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/johan18/32/748_2.png) [@Johan18](https://community.appfarm.io/u/Johan18)\
**Post date:** [April 29, 2024, 1:13pm UTC](https://community.appfarm.io/t/multi-reference-feedback-and-question/1159/9 "2024-04-29T13:13:42Z")

</div>

Sent in a message! … .
