Category selector > defined values > Integer - How to call this in an indicator widget used advanced formatting

412
0
08-06-2022 02:26 PM
Lindsay
Occasional Contributor

Hi Dashboarders,

I've created a category selector that looks at years into the future (below).

Based off of the year the user selects, I want to run a little calculation. For example, if year = 10 and species = x, output new values. This will run for only 5-10 of the features in the service. First half of the calculation is shown below.

Is this possible? If not, is there a way to work around this? The years into the future question/action happens at the dashboard level, not written into the attribute prior to the dashboard, so I can't run the calculation in Edit/forms/calculated expressions.

Lindsay_0-1659820809850.png

 

var futureyearsfilter = the Integer Selector Years into the Future
//How/what do I call this? in the dashboard
var regionage = $datapoint["FF_Region_Age"]

var primaryspecies = !IsEmpty(regionage)
var newagevalue = When(
    futureyearsfilter = 0, regionage,
    futureyearsfilter = 10, regionage+10,
    futureyearsfilter = 20, regionage+20,
    futureyearsfilter = 30, regionage+30,
    '')
    
return newagevalue

 

0 Replies