I'm getting an error when writing an Arcade expression for a pop-up.
I have a table called "Rose Classes" with two fields: "Class" and "Description". I have a feature layer with a field called "Class". The Class field in the table matches the Class field in the feature layer. For a given Class within the feature layer, I want to return the Description for that Class from the Rose Classes table.
I asked ChatGPT for help and got the code below, which outputs "Test execution error: Execution error - Cannot access value using a key of this type. Verify test data."
I am very new to Arcade, so I don't even know where to begin to debug this code. I wrote in some return commands and was able to return everything but the final step.
var classesTable = FeatureSetByName($map, 'Rose Classes');
var currentClass = $feature.Class;
var matchingFeatures = Filter(classesTable, 'Class = @currentClass');
var description = '';
if (Count(matchingFeatures) > 0) {
description = matchingFeatures[0].Description;
}
return description;