|> map(fn:(r) => ({
r with
_field: "RUNNING",
_value: r._value * 30
}))
You could even layer in a little conditional logic into the map()
function to reassign values in the the _field
column based on their current value. For example, if you had the following _fields
:
- green
- grey
- red
You could:
|> map(fn:(r) => ({
r with
_field: if r._field == "green" then "RUNNING"
else if r._field == "grey" then "SLEEPING"
else if r._field == "red" then "STOPPED"
else "unknown",
_value: r._value * 30
}))