Canvas from minutes to hours

Hey there!

You might consider using a few mapColumn function calls in your expression to get the minutes turned into other units. You'll have to do a bit of tweaking but maybe try something like this:

filters
| essql 
  query="SELECT uptime FROM \"device_data_bridgenuzoo\" ORDER BY date DESC LIMIT 1"
| mapColumn name="days" fn={math "floor(uptime/60/24)"} 
| mapColumn name="hours" fn={math (uptime - days*60*24)/60"}
| mapColumn name="minutes" fn={math "uptime - days*60*24 - hours*60"}
| markdown "### Uptime: ###
{{#each rows}}
{{ days }} {{ hours }} {{ minutes }}
{{/each}}"
| render

Give that a shot and let me know how it works!

1 Like