Select to view content in your preferred language

Filtering Chart Results in Cannot Access Data Error

635
1
Jump to solution
03-04-2024 12:50 PM
Labels (1)
ArielLow2146
Frequent Contributor

I'm using the following data expression for both my category selector and my serial chart widget.

// Reference layer using the FeatureSetByPortalItem() method. 
var fs = FeatureSetByPortalItem(Portal('https://www.arcgis.com'), '404e68025b454f829385dfaa326d0486' , 0, ["*"], false);

// Empty dictionary to capture each sub topic reported as separate rows. 
var choicesDict = {'fields': [{ 'name': 'Split_SubTopic', 'type': 'esriFieldTypeString'}, { 'name': 'Topic', 'type': 'esriFieldTypeString'}, { 'name': 'Chamber', 'type': 'esriFieldTypeString'}, { 'name': 'Enacted', 'type': 'esriFieldTypeString'}], 
                    'geometryType': '', 
                    'features': []}; 

// Split comma separated sub types and store in dictionary.
for (var f in fs) {
  var Topic = f["Topic"]
  var Chamber = f["Chamber"]
  var Enacted = f["Enacted"]
  var split_array  =  Split(f["Sub_Topic"], ';')
  for(var i in split_array) {
    Push(choicesDict.features, {"attributes": {"Topic": Topic, "Chamber": Chamber, "Enacted": Enacted, "Split_SubTopic": Trim(split_array[i])}})
  }
}
var result = Replace(choicesDict, "_", " ");

// Convert dictionary to featureSet. 
var fs_dict = FeatureSet(Text(result));
return fs_dict

In the serial chart I'm using categories from grouped values on the category field Split SubTopic.

ArielLow2146_0-1709585270973.png

In the category selector I'm also using categories from grouped values with the category field of Split SubTopic.

The category selector works on widgets with other data sources but the serial chart with the same data expression as the source displays a "Cannot access data" error when it is filtered.

ArielLow2146_1-1709585421930.png

Does anyone have any ideas why this might be?

0 Kudos
1 Solution

Accepted Solutions
ArielLow2146
Frequent Contributor

I was able to resolve this issue by removing the _ from the field name. I switched Split_SubTopic to SplitSubTopic.

View solution in original post

1 Reply
ArielLow2146
Frequent Contributor

I was able to resolve this issue by removing the _ from the field name. I switched Split_SubTopic to SplitSubTopic.