I have the Arcade code (below) in a data expression for an Indicator element. When I test it, it returns the correct value, but in the Data Expressions selection list the expression name is grayed out and has a warning icon stating 'Unable to execute Arcade Script'. Very helpful.
Any idea what the error is and how to fix it? Thanks!
var p = Portal('https://myPortal/')
var fs = FeatureSetByPortalItem(
p,
'7hk90262c6e641c6bc9513da29fdf346',
0,
[
'sample_id_dup',
'sample_id_pre',
'sample_id_post',
'sample_id_other_1',
'sample_id_other_2',
],
false
);
var dup = Count(Filter(fs, 'sample_id_dup IS NOT NULL'));
var pre = Count(Filter(fs, 'sample_id_pre IS NOT NULL'));
var post = Count(Filter(fs, 'sample_id_post IS NOT NULL'));
var other1 = Count(Filter(fs, 'sample_id_other_1 IS NOT NULL'));
var other2 = Count(Filter(fs, 'sample_id_other_2 IS NOT NULL'));
return dup + pre + post + other1 + other2;
Solved! Go to Solution.
Data Expressions require that you return the results as a FeatureSet. You're just returning a number, which isn't valid. You'll have to convert your result into a FeatureSet. This post shows one way of doing that
Data Expressions require that you return the results as a FeatureSet. You're just returning a number, which isn't valid. You'll have to convert your result into a FeatureSet. This post shows one way of doing that
Thanks @KenBuja . I'll keep that in mind in the future. Not sure why a scripting language only allows returning a feature set, but it is what it is.