Blocks for working with tables (2D lists with header row)

I have a project that helps me track my energy usage.
One problem is that some charging periods are too small and the kWh/day number is too coarse and needs smoothing

so I used to use this
power_elec_gas_energy_octopus script pic
but its very tricky to debug and change so I've made some new blocks

So the for each c-block is slight different to the standard one

It does 3 things extra

  • Creates a script var _table_header that is then available to use in the other blocks in the library
  • Skips the 1st row but keeps the loop counter as standard
  • And a magic set menus block ( © @cymplecy) :slight_smile: that changes the menus of the other blocks based on the header row of the table

This library is a bit dodgy in that you can't nest them i.e. you can't run another one of them inside one as the _table_header script var is hard coded

And also you have to run the set menu block once before you can use the menus in the other blocks :slight_smile:

But might be useful for someone other than me

Or inspire someone to make a better version :slight_smile:

The current dev version does some of that; you can have dictionaries (key/value pairs) in which you can say things like untitled script pic to get the value of the item whose key is foo.

I was inspired by the change to the item of block in 8.1 to make these blocks, even though they ended up not needing the new facilities :slight_smile:

They basically hide getting the indices of the column names to address items of each record in the table

I can't see any change from 8.1 to current dev that affects doing this

Sorry, I lose track of what happened in what release until I have to update the manual (which is what I should be doing right now instead of hanging out on the forum!).