Select to view content in your preferred language

Show minimum value in a range of data

419
1
06-13-2022 02:56 AM
BenBlowers2
Occasional Contributor

Hello all,

I am trying to summarise some data from multiple borehole surveys. Each borehole is visited up to 6 times, and each time a new record is submitted via Survey123. The depth to water is recorded on each visit. I would like a simple table, or indicator that shows this in a dashboard, so it looks something like this:

Depth to Water
BoreholeVisit1 (R1)Visit2 (R2)Visit3 (R3)Visit4 (R4)Visit5 (R5)Visit6 (R6)MinMax
BH1012.62.43.22.53.22.92.43.2
BH1021.81.61.61.31.91.51.31.8

 

At the moment I can only get the Dashboard to show each visit as a new line in either the table or list. Is it possible to show this data summarised, so that just 1 line exists for each borehole? And then show the different depths recorded, and use an expression to highlight/pull out the min/max?

BenBlowers2_0-1655114120650.png

Thank you,

Ben

1 Reply
JohannesLindner
MVP Frequent Contributor

You can use the GroupBy function for that:

var test_data = {
    geometryType: "",
    fields: [
        {name: "Borehole", type: "esriFieldTypeString"},
        {name: "Visit", type: "esriFieldTypeString"},
        {name: "WaterLevel", type: "esriFieldTypeDouble"},
        ],
    features: [
        {attributes: {Borehole: "BH101", Visit: "R1", WaterLevel: 2.6}},
        {attributes: {Borehole: "BH101", Visit: "R2", WaterLevel: 2.4}},
        {attributes: {Borehole: "BH101", Visit: "R3", WaterLevel: 3.2}},
        {attributes: {Borehole: "BH101", Visit: "R4", WaterLevel: 2.5}},
        {attributes: {Borehole: "BH101", Visit: "R5", WaterLevel: 3.2}},
        {attributes: {Borehole: "BH101", Visit: "R6", WaterLevel: 2.9}},
        {attributes: {Borehole: "BH102", Visit: "R1", WaterLevel: 1.8}},
        {attributes: {Borehole: "BH102", Visit: "R2", WaterLevel: 1.6}},
        {attributes: {Borehole: "BH102", Visit: "R3", WaterLevel: 1.6}},
        {attributes: {Borehole: "BH102", Visit: "R4", WaterLevel: 1.3}},
        {attributes: {Borehole: "BH102", Visit: "R5", WaterLevel: 1.9}},
        {attributes: {Borehole: "BH102", Visit: "R6", WaterLevel: 1.5}},
        ]
}
var boreholes = FeatureSet(Text(test_data))
//return boreholes

var range_statistics = [
    {
        name: "Min",
        expression: "WaterLevel",
        statistic: "MIN"
    },
    {
        name: "Max",
        expression: "WaterLevel",
        statistic: "MAX"
    }
    ]
var boreholes_with_range = GroupBy(boreholes, "Borehole", range_statistics)
return boreholes_with_range

JohannesLindner_0-1655115794347.pngJohannesLindner_1-1655115854037.png

 


Have a great day!
Johannes
0 Kudos