MIGX: Customizing the Loop to filter out unused items

I have a dropdown field in a form that is showing all items from a MIGX list. Is there a way to filter out any item that has not been used by a resource yet?

Here’s what I currently have:

    &tpl=`@CODE: <option value="[[+value]]">[[+name]]</option>`
    &toPlaceholder = `myPlaceholder`


What do you mean by “that has not been used by a resource yet”?
Can you provide more information about the package? Maybe the schema?

Basically you can filter the output with the &where-property.

So for example, with a list of schools. At one point we added University of Pennsylvania for someone and then they left the company. This school is still in the list, but is no longer attached to anyone’s profile.

So when the filter displays the list of schools to filter by, I don’t want that school to even show as an option.

I’m not sure what else i can show you.

So all you school are saved in a custom database table.
But where to you save the connection from a resource to a school? As a listbox-multiple TV in the resource?

It’s set as a migx tv with a configuration applied. I’m not sure what that means.

If you use a MIGX TV, then the information for the connections between resources and schools is stored as a json-string in the database table “modx_site_tmplvar_contentvalues”. That means, that there is no way to filter your data with migxLoopCollection.

1 Like