I am struggling with how to adapt the msg.payload structure I have to an ui template based table. I suspect someone will see an easy way to do what I am attempting.
Each msg.payload is an array of 2 objects structures. Each object has a consistent number of items. Example:
array[2]
0: object
Index: 738
Time: 1593642608.9093015
Temperature: 33.42
Pressure: 1000.5715275790338
Humidity: null
Sensor: 2
Altitude: null
Host: 1
1: object
Index: 737
Time: 1593642608.8785386
Temperature: 32.92019531548027
Pressure: null
Humidity: 33.15327687495232
Sensor: 3
Altitude: null
Host: 1
I would like to group the two objects, each msg.payload instance, in the same table frame, so they can have a common caption, which would be the Host value in the above objects.
+-------------------------------------------------------------------------------------+
| Host |
+-------------------------------------------------------------------------------------+
| Index | Time | Temperature | Pressure | Humidity | Sensor | Altitude |
+-------------------------------------------------------------------------------------+
| | | | | | | |
+-------------------------------------------------------------------------------------+
| | | | | | | |
+-------------------------------------------------------------------------------------+
+-------------------------------------------------------------------------------------+
| Host |
+-------------------------------------------------------------------------------------+
| Index | Time | Temperature | Pressure | Humidity | Sensor | Altitude |
+-------------------------------------------------------------------------------------+
| | | | | | | |
+-------------------------------------------------------------------------------------+
| | | | | | | |
+-------------------------------------------------------------------------------------+
+-------------------------------------------------------------------------------------+
| Host |
+-------------------------------------------------------------------------------------+
| Index | Time | Temperature | Pressure | Humidity | Sensor | Altitude |
+-------------------------------------------------------------------------------------+
| | | | | | | |
+-------------------------------------------------------------------------------------+
| | | | | | | |
+-------------------------------------------------------------------------------------+
The number of msg.payloads will be up to about 20 or so, so this table will not be an insane size. I already have the SQL queries working to grab the data, have a loop node to walk through the number of paired records found. The issue is how to transform the data into a ui_template of course.
I suspect that each section is its own ui_table object? I am sure using ng-repeat
methodology is foundational to this effort? The trick, getting the column headings and the caption set per group/pair of records? This is encouraging my hair to fall out... faster.
Thanks in advance for any assistance.