Filtering on Reference Fields

Question:
OK - the next big challenge for me (and my learning) is to figure out how to use reference fields in order to have some master data consistency and ALSO be able to filter on these fields. From what I understand this requires Velo code. Could someone perhaps refer me to a couple good resources or examples on this? Thank you!

Product:
Editor X

What are you trying to achieve:
Use a reference field to control master data but also do not lose ability to filter by that field.

What have you already tried:
Nothing yet - I just know you cannot do this w/o coding which I am new at.

Additional information:
Non

Hello! To get started take a look through this documentation Querying Items that Reference Other Items

If that is not enough to get started, happy to help further.

One note to consider if your site is new - EditorX platform has been deprecated so if possible you may want to consider building on Wix Studio. There is also migration functionality in the process of being rolled out to move an EditorX site to Wix Studio. This is not required - just a suggestion in case you were not aware.

Thank you. I do plan on migrating as soon as I see the option appear.

1 Like

What I want to do appears to be much simpler that your example / resource. I simply want to filter a repeater on a field that is a reference field.

The requirements are:

  1. the drop down would be populated with the unique values in that field (like normal)
  2. once drop down value is chosen, the repeater would update to only show matching records.

thanks, Ted

Ah, I think this may be the tutorial you are looking for then Using Connected Datasets and Repeaters

Also this may be of use CMS (Formerly Content Manager): Using Input Elements to Allow Visitors to Filter Content | Help Center | Wix.com

Please review and let me know if that’s more appropriate

OK … so I have the following code which worked prior to converting the CMS field to reference (it was Text prior). Now it does not filter anything correctly … I have a hunch it is comparing the text in the drop down (which is correct) to the long gibberish key value or something - no idea.,

I think your code snippet didn’t save. Let me go through my examples adn see if I have something I can spin up that will be easier to understand then chatting back and forth.

This is where I am currently. My new hunch is that I am not referring to the CMS reference field correctly in the filter. In the repeater this text element is connected to the reference field in is called Status: Title (the Title field in the Status element which represents the Student Status dataset. My much is that the issue is in line 23. I need the left side of that eq. condition to represent the reference field in the dataset.

Sorry, I think the miscommunication here is that this does not require code unless I’m misunderstanding your requirement. I created a screen recording btu didn’t realize I couldn’t share that here. If you happen to be in our Discord community, let me know and I can send it there.

In short, I have 2 collections. Candy and Status - candy references status

the repeater and dropdown are connected to the candy dataset.

EDIT: here is a screenshot that will hopefully help. The repeater and dropdown are connected to the same dataset

Well holy cow … it is working. I swore I saw in a few places that you could not do this without code! Thank you!

1 Like