How to filter RadioButton/DropDown options from one collection by a field in a second collection

I'm hoping to get some help setting up a widget that shows users options from a collection, but only showing the user options included in a list of document references in a second collection.

As background, the project is using a Firestore database on the backend with two collections, A and B.

- Collection A has a field called aLabel (Datatype is string, not a list)

- Collection B has a field called aDocRefList (Datatype is a list of document references to collection A).

I want to create a RadioButton or or DropDown widget (so user can only select a single option) that:

- Includes as options all of the documents in collection A that are included in the aDocRefList field in collection B.

- Shows the user the aLabel field in the UI for each available option (not the document IDs/references)

- Returns the documentID of the selected option as the Widget State, not the aLabel field shown in the UI

I've tried setting up the RadioButton with a backend query 'Query Collection' on collection A returning a List if Documents, but I can't figure out how to then filter that list based on whether each document is in the aDocRefList field.

Any ideas? Or will this require a Custom Function? Very much appreciate any help.

1
1 reply