Select to view content in your preferred language

Dashboard Indicator data expression 'Unable to execute Arcade script'

801
2
Jump to solution
04-28-2023 06:01 AM
Labels (1)
ZekeMI
by
Frequent Contributor

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;

 

 

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

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

View solution in original post

2 Replies
KenBuja
MVP Esteemed Contributor

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

ZekeMI
by
Frequent Contributor

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.

0 Kudos