Select to view content in your preferred language

Convert field from feet to miles for Dashboard Serial Chart

189
0
09-18-2024 10:33 AM
shildebrand
Frequent Contributor

Does anyone know how to convert a field that has units in feet to miles for use in a serial chart within ArcGIS Dashboards?  Essentially I need to display a line graph showing month by month the total sum of water main lengths in miles.  Using the raw dataset I already have (with lengths in feet), the dashboard options allow for this out of the box. 

shildebrand_1-1726680687331.png

 

But because dashboards requires an arcade expression to result in a Feature Set, it appears that I need to create a summary table to do this?  Below is an expression that does not result in errors, but does not respond after clicking "Done" in the expression dialog.  I'm guessing this is too much for the server to process (118K records)  Any thoughts or suggestions would be greatly appreciated!

var sql = "ownedby = 1 And lifecyclestatus = 8 And (installdate IS NULL Or installdate <  date '01 Jan 2025 12:00:01 am')"

var waterMain = Filter(FeatureSetByPortalItem(Portal('https://wapgis65.epcor.ca/portal'), 'f1a0edc6c51c478282f35188c509cfdd', 15, ["measuredlength", "WATERSYSTEM", "ownedby", "installdate", "CREATIONDATE"], false), sql)

var sumWaterMain = GroupBy(waterMain, ['WATERSYSTEM', 'CREATIONDATE'], [ { name: 'miles', expression: 'measuredlength / 5280', statistic: 'SUM' }]);

var combinedDict = { 
  fields: [ 
    { name: "system", type: "esriFieldTypeString" }, 
    { name: "date", type: "esriFieldTypeDate" },
    { name: "miles", type: "esriFieldTypeDouble" }, 
  ], 
  geometryType: "", 
  features: [], 
};

var i = 0; 
// Loop through each FeatureSet and store its attributes 
for (var s in sumWaterMain) { 
  combinedDict.features[i++] = { 
    attributes: { 
      system: s["WATERSYSTEM"], 
      date: s["CREATIONDATE"],
      miles: s["miles"], 
    }, 
  }; 
}

// Return dictionary cast as a FeatureSet  
return FeatureSet(Text(combinedDict));

 

 

 

0 Kudos
0 Replies