Hello,
I'm a beginner in all things Arcade and I'm having some trouble with an Arcade expression for ArcGIS Dashboard. I have a table of names that I will be pulling into a Pie Chart widget to show all repeated names as categories, so if John Doe is repeated 5 times and Jane Doe is repeated 3 times, then John Doe gets a bigger slice of the pie chart. But the widget has a max of 300 categories and my table has over 400 records, so I need to filter the data down to only the repeated names before it tries to render in the Pie Chart. Which leads me to trying to create a data expression.
The part I'm stuck on is figuring out what function to use to identify repeat values in a field. Online research shows quite a bit about how to find unique values, but I really need the opposite of that.
So far I have,
var portal = Portal('https://someportal.com/')
var tablefs = FeatureSetByPortalItem(
portal,
'tableportalitemid',
1,
['*'],
false
);
// Create empty dictionary of all fields you want the pie chart to reference
var dict = {
fields: [
{ name: "wholename", type: "esriFieldTypeString" },
{ name: "GlobalID", type: "esriFieldTypeGlobalID" },
],
geometryType: "",
features: [],
};
I think the rest of the logic would be something like;
//Create a list of all values in tablefs wholename field
//Where wholenames are not distinct, store into an array.
//Create more logic to loop through the tablefs and if wholename value exists in array then push all matching features into dictionary
//Finally export dictionary to featureset to reference in Pie Chart Widget.
Thanks very much for any insight and advice,
There may be a better way..