Doug,
Thanks. This definitely pointed me in the right direction. Since I'm not an arcade coder, I'm having a hard time getting this to work the way I want. I am able to get fields to be included but the graph isn't displaying the way I want. Below is how I implemented the code sample from you. I tried with 2 inspection items to sample. I am able to create a stacked graph but I need to display the inspection item (i.e. Tires or Lights) on the Y axis of the graph and the condition count on the graph: Green = Good, Orange = Needs Maintenance, Grey = N/A and their size is the count or sum of the inspections submitted. I am getting separate graph elements from the inspection items in the script, but I am not sure how to label them correctly or setup so I can filter by Vehicle or Date and see how many of each condition have been reported through the survey.
I appreciate your input.
Thanks,
Andy
var p = 'https://arcgis.com/';
var tbl = FeatureSetByPortalItem(Portal(p),'434c9f800ef84a95bb0b20763135c82c',0,['*'], geometry = false);
var dups = []
var Dict = {
'fields': [{ 'name': 'condition_assessment_tires', 'type': 'esriFieldTypeString' }],
'geometryType': '',
'features': []};
var index = 0
var last = ''
for (var f in OrderBy(tbl, "condition_assessment_tires")) {
if (f.condition_assessment_tires == last) {
Dict.features[index] = {
'attributes': {
'condition_assessment_tires': last,
}}
++index
}
last = f.condition_assessment_tires
}
for (var f in OrderBy(tbl, "condition_assessment_lights")) {
if (f.condition_assessment_lights == last) {
Dict.features[index] = {
'attributes': {
'condition_assessment_lights': last,
}}
++index
}
last = f.condition_assessment_lights
}
return FeatureSet(Text(Dict));