Hello,
I'm trying to use DISTINCT in my Arcade expression (see below) in my web map popup, but am not getting the expected results.
I'm trying to return the unique route for each customer. I'm relating this table to a point feature class. I published my map service (to our ArcGIS Servers) with the point feature class and the two view tables, and using the FeatureSetByName $datastore for the var tbl.
When I Console(customers) to view the results, I get 'Object, FeatureSet'? Does Distinct work on feature classes only or does it work with tables?

Here's my Arcade expression...
var tbl = FeatureSetByName($datastore,"SWM Routes Table");
Console(Count(tbl));
var id = $feature["CO_ID"];
Console(id);
var sql = "CONNECTION_OBJECT = '" + id + "'";
Console(sql);
var customers = Distinct(Filter(tbl, sql), "ROUTE");
Console(customers);
var cnt = Count(customers);
Console(cnt);
var result = "";
if (cnt > 0) {
for (var customer in customers) {
result += TextFormatting.NewLine + "Route: " + customer.ROUTE +
" / " + customer.Supervisor + " / " + customer.COLLECTION_DAY +
/* TextFormatting.NewLine + "Customer: " + customer.BP_Name +
TextFormatting.NewLine + "Business Partner: " + customer.BP_Num +
TextFormatting.NewLine + "Contract Account: " + customer.ContractAcct +*/
TextFormatting.NewLine;
}
} else {
result = "No customer data"
}
Console(result);
return result;
Anyone have experience with using Distinct in a related (1:M) table or have suggestions?
Thanks,
Don