Introducing the feature you've been all waiting since you tried Reference Field Type – ability to add multiple items from referenced collection.
Be aware that if you decide to update your current Reference field type to allow multiple items, your previously added items would not be preserved, so make sure you backup your data or start with creating a new field.
There're also some changes in how you should connect your data when working with Multiple Item Reference field in Editor. Unlike Reference field type in Single Item mode, you won't be able to connect this field type directly to components. Instead, you need to rely on Dataset. Whenever you want to show Movies and their Actors, just add 2 datasets – one for movies and one for actors – and then apply a Filter by Dataset.
Might sound confusing at first, but once you go over this article, you'll be an expert: https://support.wix.com/en/article/working-with-multiple-item-reference-fields.
Also, some more details of how Reference field in this new Multiple Item mode works can be found here: https://support.wix.com/en/article/about-referencing-multiple-items-in-one-reference-field.
Some multiple item reference API:
hasSome() (aka includes some of)
Last but not least, we would really appreciate if you give us some feedback on this feature by filling in this anonymous 4-question form.
Hi everyone
I have 3 collections one is Showcast collection and another People & CastRoles collections.
i am creating reference fields in showcast collection .how to submit form with two reference fields.expect showid textbox remaining 2 user inputs reference fields.those three user inputs conncets to showcast dataset .but reference fields are not visible to conncets to daatset its not possible how to solve this issue.i am trying insert reference [ https://www.wix.com/corvid/reference/wix-data.html#insertReference ] i am getting error is "reference is broken".
Thank you..
please give me any suggestion or coding snippits [wix corvid reference].
Hi everyone
I have 3 collections one is Showcast collection and another People & CastRoles collections.i am creating reference fields in showcast collection from those reference fields are one peoples collection in person id and CastRoles collection in Role id.
=>Design part is find out below screen shot
1) This is showcast collection in creating reference fields.
=> This is Peoples collection
=> This is CastRoles collection
=> i am using below code adding reference filed's :
$w('#submit').onClick(() => { let a = $w('#RolsSelection').value; let b = $w('#Person').value; let c = $w('#ShowId').value; wixData.aggregate('ShowCasts') .group('title') .avg('title').descending('title') .run() .then((res) => { let item = res.items[0]; maxid = item._id; console.info(maxid); maxid++; $w("#showcastdataset").setFieldValue("title", maxid); $w('#showcastdataset').setFieldValue('roleId', (a)); $w('#showcastdataset').setFieldValue('personId', (b)); $w('#showcastdataset').setFieldValue('showId', (c)); $w('#showcastdataset').save(); }) //submit.onclick }) })
=> according to above code output like this way.please check the below screenshot.
But i don't want to like above output ,no need to [reference is broken ] i want to adding the number only.
i) I try to find out the solution using below code please check these 2 screenshots:
=>according to above code ,i got output output like this find out below screen shot
ii) I tried on Another way using this below code:but it's not working.
=> Finally i want to like this way of OUTPUT in below screen shot .please give me any suggestions (or) send me if you have any examples.i hope i am getting a positive response form your's.Thanks for your valuable time spending on above issue.
Thanks & Regards
koteswararao
Hi
I have 3 collections i am creating reference fields in one collection from taken other 2 collections in fields .how can i submit form reference fields in a collection using code .but i am trying to insert reference method but it's not working. i didn't get any idea how to do.if you have any examples please send me.thank you.
Hi there... so using the Movies and Actors analogy.... I have a database with movies (and a separate one with actors). Now I want to add the actors to the movie using a multi-items reference field. How do I do that on a form? I can add the actors, but how do I connect them to the movie? This is the part that I am missing.
It seems like Wix is very close to having an input solution with the User Input Object "Multiple Selections", however it only works with field type "Tags". Unfortunately "Tags" do not offer the same filtering options as references. It doesn't seem like a far leap to adapt the Multiple Selection object to attach to a Multi-Item Reference field. PLEASE?
Hello fellow Wixers,
I'm trying to have people enter data into a multi-item reference field of a collection using a selection box input. However, I can't seem to be able to connect that selection box to the multi-reference field of my collection.
To take the movies-actors analogy, I am trying to have people enter details of a movie and use multiple selection to select the actors who appear in the movie. I have a dataset linked to the movie collection on the page, and that collection contains a multi-reference field mirrored in the actors collection. How can I link the selection box to offer the list of actors in the actors collection so that people can select all the actor who appear in the movie, and then hit a submit button that will fill data in the movie collection with the details provided, along with the multiple selection of actors?
Any hint would be much appreciated
Hey
Any news?
Thats a good question.
The list is as follows:
Multiple Item mode gives you a mirror field in referenced collection (regular reference doesn't)
Technically, multiple reference field values are not stored under specific field key; in regular reference, before you do include() you can see id values of items from referenced collection; with multiple reference field, you won't see these ids
Multiple Item Reference field would require special API (insertReference, isReferenced, queryReferenced, removeReference)
You can't bind Multiple Item Reference field to any of the elements, you need to use another Dataset and link it with filter
Toda. Can you compare please regular reference field usage and properties to multiple with one reference?
You can change the name of this field later, but the not the field key.
Thanks. I found automatically generated field (i just supposed that it is the same one field) and it works. Any chance to choose a name for this field?
Hey @zufi zuff,
Quick update about your previous question. You are actually better off using count() method as it will give you a slightly better performance.
Now, getting back to your last questions: 1. You can. And like with reference to another collection, you'll also get an automatically generated mirror field. So if to your Persons collection you add a field "Parents", you'll also get a mirror field that would conceptually mean "Parent to". Let me know if you still face some issues with setting this up.
2. Basically, since you can't connect multiple item reference field directly to component and because of it you must use another dataset, you can actually do whatever dataset is capable of, including connecting to repeater and using any gallery that can be connected to dataset.
Shalom Adas
Thanks for response.
2 questions:
1) For regular reference field reference to the same collection is possible by documentation. Is it possible for multiple-item (ex Persons collection with relatives)? Trying to implement this but even Preview button doesn't work.
2) You mentioned tables and galleries in the articles. What about repeaters? What kind of galleries?
@Patrick, you can probably workaround this by chaining multiple hasSome() filters, all of which would contain single item as value to match.
@zufi zuff, you can. The results returned have totalCount property.
Is it possible to count items in multiple reference field?
@Adas Bradauskas I see that you can use hasSome() but what about hasAll()? I got hasSome() to work and see that it mentions references in the API but hasAll() does not work. Will this be released soon? Hopefully this week.. I have a deadline and I needed the hasAll() function.
Hey @Jeff Haskins! I'll try to elaborate how you should use multiple item reference field when connecting it in Editor.
First of, let's say you have Movies and Actors collection, and each of the Movie has multiple item reference field to Actors (and vice-a-versa). Now, let's say you've create a Dynamic Item Page for Movies, and in that page you wanna list it's actors. So you add Table or Repeater, then you need to have a Dataset that is connected to Actors database collection and connect Actors data to Table or Repeater.
At this point, Actors Dataset returns you all your actors, but not actors per a specific movie. What you wanna do right now is to filter only those actors that acted in that particular movie. So this is the place where you need to use filter on multiple item reference field. What you're saying to Actors Dataset is basically "give me only those actors that in their Movies field (multiple item reference) contain this movie from Movie Item dataset".
So again, you can't directly bind multiple item reference field to components, but by using 2 datasets and a filter you're able to achieve what you intended.
Oh, and thanks for all the bugs you reported here!
They also need to provide expansion for this box....with the minimized view they provide, the scrolling feature makes it hard to find items. Need to be able to see a few more rows since you can not control scrolling speed, you have to click/unclick to move at a pace to really see things. At least make it about 10 items to be viewed in the box to make it easier to use! (lots of "feedback" on this feature from me, but it really does need these items to be fixed as they appear to be overlooked in rolling it out. IF you are going to have a feature, it needs to work well and be explained well.
Also need to adjust row height on their database now that they have added the multiple option...could barely see the switch iin previous so had to minimize my screen to actually click on it. Now it is not viewable at all, so can not click to make a ref field have multi-ref at all (have tried changing screen resolutions, size, etc.
Question: When you have deleted fields in a database, it allows you to restore by going to the deleted field list..however, if you have quite the number of deleted fields, there is no scroll feature so only way you can see the deleted items that do not show at top is to restore those top fields to get those unseen deletions. Am I missing something?