Hello all, please forgive me if my question is too easy but I am trying to learn velo for developing my own website.
I've been following the wix wiz youtube tutorials and I think they are amazing. But since I am new to javascript and velo in wix, I am finding it difficult to follow along :) I've been reading the velo documentation and trying to understand the parameters in the WixData.queryReferenced function. The first parameter is the collection ID. That I think I understand. But I am struggling with the second parameter -the "item" which is supposed to be a union (btw I have no idea what it is). The third parameter is the PropertyName and I belive it refers to the multi-referenced field in the collection ID.
Can you guys help me understand what the "item" parameter in queryReferenced refers to?
Below is an image of a sample collection with multi-reference fields. The collection has an ID "Printsizes"

If I would like to do queryReferenced on this collection, I believe the first and third parameters should be "Printsizes" and "Printmaterial_2X3Sizes", respectively e.g.,
queryReferenced("Printsizes", "item", "Printmaterial_2X3Sizes")
However, I have no clue what the second parameter "item" is. I wanted to access the first row and references in "Printmaterial_2X3Sizes" column, is the second parameter in queryReferenced just "4x6"? Your help will be very much appreciated!
Hi Abedin, Thanks for watching the channel, I'm glad to hear you are finding it useful!
In queryReferenced (and references in general) the items can be the itemId (or the full item). The first begin the ID of the referring item and the second (when present) being the ID of the referenced item (from another collection). To find the item ID you can click on "manage fields" in the CMS and toggle the system field for ID on. (Though you would probably do this programmatically vs. manually in your code). So for example
Collection A has a reference field to Collection B called "collectionBfield" -
queryReferenced("CollectionA", "itemIdFromCollectionA", "collectionBfield") insertReference("CollectionA", "itemIdFromCollectionA", "collectionBfield", "itemIdFromCollectionB")
Hope that helps
Eitan