{"payload":[
{
"count": "13",
"name": "joep",
"total": 1
},
{
"count": "7",
"name": "joep",
"total": 1
},
{
"count": "3",
"name": "kees",
"total": 1
},
{
"count": "2",
"name": "joep",
"total": 1
},
{
"count": "119",
"name": "bart",
"total": 1
},
{
"count": "251",
"name": "joep",
"total": 1
},
{
"count": "0",
"name": "bart",
"total": 6
}
]}
$distinct(payload.name).(
$Cur:= $;
{
"name":$,
"count":$sum($$.payload[name=$Cur].count.$number()),
"total":$sum($$.payload[name=$Cur].total)
})
[
{
"name": "joep",
"count": 273,
"total": 4
},
{
"name": "kees",
"count": 3,
"total": 1
},
{
"name": "bart",
"count": 119,
"total": 7
}
]
{
"names": [
{
"name": "joep"
},
{
"name": "joep"
},
{
"name": "kees"
}
]
}
{
'names': $.names{name: $count(name)}
~> $each(function($v,$k){
{
'name': $k,
'total': $v}
})
}
{
"names": [
{
"name": "joep",
"total": 2
},
{
"name": "kees",
"total": 1
}
]
}
[
{
"Average Depth": 9
},
{
"Average Depth": 0
},
{
"Average Depth": 7
}
]
$average(`Average Depth`[$>0])
8
- Input - array of measurements
{"payload":[{"measures": {
"02:00:00:14:48:e6": {
"res": {
"1594359105": [
14.8,
96
]
},
"type": [
"temperature",
"humidity"
]
},
"70:ee:50:14:54:8a": {
"res": {
"1594359112": [
1009.4
]
},
"type": [
"pressure"
]
}}
}]}
(payload.measures.*.$zip(type, res.*)).{
'label': $[0],
'value': $[1]
}{
label: $average(value)
}
{
"temperature":14.8,
"humidity":96,
"pressure":1009.4
}
input
[
{
"time": "2020-05-18T19:09:53.000Z",
"Temperatur": 24.1
},
{
"time": "2020-05-18T19:09:58.000Z",
"Temperatur": 24
},
{
"time": "2020-05-18T19:12:48.000Z",
"Temperatur": 23.9
},
{
"time": "2020-05-18T19:13:27.000Z",
"Temperatur": 24
}
]
$^(Temperatur)[[0, -1]]
[
{
"time": "2020-05-18T19:12:48.000Z",
"Temperatur": 23.9
},
{
"time": "2020-05-18T19:09:53.000Z",
"Temperatur": 24.1
}
]
input
{
"payload": [
{
"Country": "Netherlands Antilles"
},
{
"Country": "United States"
},
{
"Country": "United States"
},
{
"Country": "Bahamas"
},
{
"Country": ""
},
{
"Country": ""
}
]
}
$distinct(payload[Country]).{
'country': Country
}
[
{
"country": "Netherlands Antilles"
},
{
"country": "United States"
},
{
"country": "Bahamas"
}
]