Tell us what you are trying to do?
Filter view to display UNIQUE custom field values
to explain further: I have a list of 'employees' each employee is assigned a 'division' as a custom field value. I am trying to build nested views that shows a list of each division with a list of employees belonging to that division right below it. How do I make a view that lists the unique VALUES of the division custom field for employees?
I can make a view that lists every employee's division field value, but I just want the field values listed, not the employees.
This is probably a lot simpler than I am thinking it is... or maybe I have my data structured incorrectly. Do I need to make 'Divisions' a taxonomy maybe? Or is there a way to list only UNIQUE values for a field?
Hello,
There isn't such kind of built-in feature within Toolset plugins, you might consider custom codes, for example:
https://stackoverflow.com/questions/58026099/get-a-list-of-custom-field-values-limited-by-post-category
If not too much values in that custom field, you can consider to pass the field value manually to child post view, see our document:
https://toolset.com/documentation/user-guides/views/passing-arguments-to-views/#controlling-the-filter-with-shortcode-attributes
hmmm....
I have been making a lot of use of passing arguments, but I am struggling to understand how to use that to accomplish what I am after here.
Maybe I should explain differently, maybe there's a different solution.
I want to return only the FIRST instance of each value for the field. Is that possible? Like how if you make a custom search filter checkbox based on a text field, you end up with a checkbox for each value that is entered into the field. Can I do something like that with a passed argument? If so, how?
I only have 13 values, and doubtful it would ever go over 20.
As I mentioned above, there isn't such kind of built-in feature, you will need to consider custom codes or pass the field value to view's shortcode manually :
https://toolset.com/forums/topic/filter-view-to-display-unique-custom-field-values/#post-1910171
Like how if you make a custom search filter checkbox based on a text field, you end up with a checkbox for each value that is entered into the field.
That is for custom search form, it does not work for your case.
I was able to accomplish this by taking the field data and making it a taxonomy instead.
Then I made a view that lists taxonomies, and in the loop template, I nested another view that lists the loop items and set the query filter to taxonomy.