Select to view content in your preferred language

Advanced formatting using Arcade in Dashboards

341
2
04-02-2023 01:37 PM
Labels (1)
AurelienJOSSET
New Contributor II

Good morning,

I am trying to display in Dahboard via an indicator widget the sum of the Length shape of a layer by filtering such that the frequency is different from 0.

With the help of the community here is the expression:


var filter = Filter($layer, 'FREQ_MAINTENANCE <> 0');

var Sum = Sum(filter, 'Shape__Length');

return Sum;

 

However Dashboard with the advanced format, I'm forced to use $datapoint and I don't really see how to get out of it.

Which formula to put before the return

return {
  //textColor:'',
  //backgroundColor:'',
  //topText: '',
  //topTextColor: '',
  //topTextOutlineColor: '',
  //topTextMaxSize: 'medium',
  middleText: $datapoint.sum_Shape__Length,
  middleTextColor: '',
  middleTextOutlineColor: '',
  middleTextMaxSize: 'large',
  //bottomText: '',
  //bottomTextColor: '',
  //bottomTextOutlineColor: '',
  //bottomTextMaxSize: 'medium',
  //iconName:'',
  //iconAlign:'left',
  //iconColor:'',
  //iconOutlineColor:'',
  //noValue:false,
  //attributes: {
    // attribute1: '',
    // attribute2: ''
  // }
}
 
After several reading of document, I did not succeed.
 
Also what is the difference between: $datapoint.field AND $datapoint.["field"]
 
Thanks for your help
0 Kudos
2 Replies
JoshuaSharp-Heward
Occasional Contributor III

Hi Aurelian,

Unless I'm misunderstanding I think you might be over-complicating things. When adding the indicator widget you're able to add a filter (in this case FREQ_MAINTENANCE not equal 0) and choose the statistic as "SUM" on "Shape_Length".

Cheers,

Josh

0 Kudos
AurelienJOSSET
New Contributor II

Hi Josh.
My return is late, sorry. I finally figured out my problem. I also misspoke. In DashBoard if you want to work on a slightly complex data set (Layer A which intersects layer B for example) you have to create it via "Data expression".

We learn every day

Bye

Aurelian

0 Kudos