I'm working on developing a dashboard for high level people within our organization. Currently, we have a field (RoadCL_FT) that is a Double data type field. I need to write an Arcade script that will allow me to add 30% to all the records in that field. Any suggestions?
Solved! Go to Solution.
You can use the GroupBy function to add 30% to a field. Here's an example from the Playground
// Fetches features from a public portal item
var fs = FeatureSetByPortalItem(
Portal("https://www.arcgis.com"),
// portal item id
"6200db0b80de4341ae8ee2b62d606e67",
0, // layer id
["*"], // fields to include
true // include or exclude geometry
);
GroupBy(fs, 'BUILDINGID', [{ name: 'Base Elevation', expression: 'BASEELEV', statistic: 'MAX' },
{ name: 'New Base Elevation', expression: 'BASEELEV * 1.3', statistic: 'MAX' }])
You can use the GroupBy function to add 30% to a field. Here's an example from the Playground
// Fetches features from a public portal item
var fs = FeatureSetByPortalItem(
Portal("https://www.arcgis.com"),
// portal item id
"6200db0b80de4341ae8ee2b62d606e67",
0, // layer id
["*"], // fields to include
true // include or exclude geometry
);
GroupBy(fs, 'BUILDINGID', [{ name: 'Base Elevation', expression: 'BASEELEV', statistic: 'MAX' },
{ name: 'New Base Elevation', expression: 'BASEELEV * 1.3', statistic: 'MAX' }])
I had to make a couple of adjustments to what you sent me, but it was what I needed to achieve the goal. Thank you for the assist!!
Do I need to create a new field for the data to be populated in?
No, you don't need to. The GroupBy function creates the new FeatureSet that you can use in your serial chart. In the code above, I added as the output both the original field and the calculated field with the 30% added, but just to compare the field. You could just include the calculated field without the original field.
Then layer that I'm trying to work with is a layer that is in a group layer or dataset. Would I plug in the ID of the group then try to limit it to the layer name?