Unique Records Displayed

Hello Retoolers!
Question, how can I get unique records to show? My datasource is running a query that currently has customers and plants (multiple plants to one customer). I COULD have two queries (one for each) that uses 'distinct' in the sql query. However, I was wondering if it is possible to do this with one query?

Below is currently the values array that is used. Can I add anything to this to show a distinct list of customers?
{{.data.customer}}

Hi and welcome to the community.

There's probably a few ways to achieve this, depending on the structure of the dataset your query is returning and how you want to use the distinct list.
I think the easiest (given you understand SQL enough to mention using a distinct clause) would be to use a "Query JSON with SQL" query against your data to get the list of distinct customers from there - this would mean you don't make another trip to the database and you can still use the existing query data for showing the full list of plants and customers if needed.

If this isn't an option then there are built-in javascipt methods in the lodash library that could also extract this distinct list from the dataset such as _.groupBy or _.uniq depending on your needs and the data structure.