DB2 ui-tabulator: Is there an equivalent to msg.ui_control to define tables?

@omrid - hoping you can help. In DB1, I was using msg.ui_control to send in the table config to ui-table, I use the same table object and format it differently based on user selected options.

msg.ui_control in each change node has the table definitions and msg.payload has the data (passed through each change node).

As an example, this is the data in msg.ui_control and msg.payload

Sample msg.ui_control
{"tabulator":{"layout":"fitDataTable","columns":[{"formatter":"datetime","formatterParams":{"inputFormat":"YYYY-MM-DD HH:mm:ss","outputFormat":"MMM-DD","invalidPlaceholder":"(invalid date)"},"title":"Day","field":"created","align":"left","width":"15%"},{"formatter":"money","formatterParams":{"precision":2,"symbol":"","symbolAfter":false},"title":"Grid","field":"fromGrid","align":"right","width":"20%"},{"formatter":"money","formatterParams":{"precision":2,"symbol":"","symbolAfter":false},"title":"Solar","field":"fromSolar","align":"right","width":"20%"},{"formatter":"money","formatterParams":{"precision":2,"symbol":"","symbolAfter":false},"title":"Battery","field":"fromBattery","align":"right","width":"22%"},{"formatter":"money","formatterParams":{"precision":2,"symbol":"","symbolAfter":false},"title":"Total","field":"totalHome","align":"right","width":"20%"}]}}
Sample msg.payload
[{"totalHome":73.18,"fromGrid":40.65,"fromSolar":25.81,"fromBattery":6.71,"totalSolar":33.5,"toHome":25.81,"toGrid":0.04,"toBattery":7.65,"fromGridPct":55.55,"fromSolarPct":35.27,"fromBatteryPct":9.17,"toHomePct":77.04,"toBatteryPct":22.84,"toGridPct":0.12,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-3","created":"2025-07-03T05:00:00.000Z"},{"totalHome":64.75,"fromGrid":18.36,"fromSolar":32.02,"fromBattery":14.38,"totalSolar":48.21,"toHome":32.02,"toGrid":0.1,"toBattery":16.09,"fromGridPct":28.36,"fromSolarPct":49.45,"fromBatteryPct":22.21,"toHomePct":66.42,"toBatteryPct":33.37,"toGridPct":0.21,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-4","created":"2025-07-04T05:00:00.000Z"},{"totalHome":59.08,"fromGrid":23.61,"fromSolar":23.9,"fromBattery":11.56,"totalSolar":37.13,"toHome":23.9,"toGrid":0.08,"toBattery":13.15,"fromGridPct":39.96,"fromSolarPct":40.45,"fromBatteryPct":19.57,"toHomePct":64.37,"toBatteryPct":35.42,"toGridPct":0.22,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-5","created":"2025-07-05T05:00:00.000Z"},{"totalHome":58.72,"fromGrid":23.44,"fromSolar":25.07,"fromBattery":10.21,"totalSolar":36.69,"toHome":25.07,"toGrid":0.06,"toBattery":11.56,"fromGridPct":39.92,"fromSolarPct":42.69,"fromBatteryPct":17.39,"toHomePct":68.33,"toBatteryPct":31.51,"toGridPct":0.16,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-6","created":"2025-07-06T05:00:00.000Z"},{"totalHome":97.26,"fromGrid":46.7,"fromSolar":39.25,"fromBattery":11.32,"totalSolar":52.18,"toHome":39.25,"toGrid":0.08,"toBattery":12.85,"fromGridPct":48.02,"fromSolarPct":40.36,"fromBatteryPct":11.64,"toHomePct":75.22,"toBatteryPct":24.63,"toGridPct":0.15,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-7","created":"2025-07-07T05:00:00.000Z"},{"totalHome":78.14,"fromGrid":17.88,"fromSolar":38.38,"fromBattery":21.89,"totalSolar":62.71,"toHome":38.38,"toGrid":0.13,"toBattery":24.2,"fromGridPct":22.88,"fromSolarPct":49.12,"fromBatteryPct":28.01,"toHomePct":61.2,"toBatteryPct":38.59,"toGridPct":0.21,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-8","created":"2025-07-08T05:00:00.000Z"},{"totalHome":86.5,"fromGrid":24.11,"fromSolar":45.48,"fromBattery":16.91,"totalSolar":64.45,"toHome":45.48,"toGrid":0.06,"toBattery":18.91,"fromGridPct":27.87,"fromSolarPct":52.58,"fromBatteryPct":19.55,"toHomePct":70.57,"toBatteryPct":29.34,"toGridPct":0.09,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-9","created":"2025-07-09T05:00:00.000Z"},{"totalHome":95.94,"fromGrid":29.68,"fromSolar":48.57,"fromBattery":17.68,"totalSolar":68.29,"toHome":48.57,"toGrid":0.07,"toBattery":19.65,"fromGridPct":30.94,"fromSolarPct":50.63,"fromBatteryPct":18.43,"toHomePct":71.12,"toBatteryPct":28.77,"toGridPct":0.1,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-10","created":"2025-07-10T05:00:00.000Z"},{"totalHome":111.79,"fromGrid":44.98,"fromSolar":52.05,"fromBattery":14.77,"totalSolar":68.42,"toHome":52.05,"toGrid":0.06,"toBattery":16.31,"fromGridPct":40.24,"fromSolarPct":46.56,"fromBatteryPct":13.21,"toHomePct":76.07,"toBatteryPct":23.84,"toGridPct":0.09,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-11","created":"2025-07-11T05:00:00.000Z"},{"totalHome":73.51,"fromGrid":40.66,"fromSolar":14.73,"fromBattery":18.11,"totalSolar":53.23,"toHome":14.73,"toGrid":0.1,"toBattery":38.4,"fromGridPct":55.31,"fromSolarPct":20.04,"fromBatteryPct":24.64,"toHomePct":27.67,"toBatteryPct":72.14,"toGridPct":0.19,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-12","created":"2025-07-12T05:00:00.000Z"},{"totalHome":62.9,"fromGrid":3.53,"fromSolar":32.06,"fromBattery":27.32,"totalSolar":44.02,"toHome":32.06,"toGrid":0.09,"toBattery":11.87,"fromGridPct":5.61,"fromSolarPct":50.97,"fromBatteryPct":43.43,"toHomePct":72.83,"toBatteryPct":26.97,"toGridPct":0.2,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-13","created":"2025-07-13T05:00:00.000Z"},{"totalHome":61.03,"fromGrid":28.55,"fromSolar":22.36,"fromBattery":10.12,"totalSolar":33.9,"toHome":22.36,"toGrid":0.04,"toBattery":11.5,"fromGridPct":46.78,"fromSolarPct":36.64,"fromBatteryPct":16.58,"toHomePct":65.96,"toBatteryPct":33.92,"toGridPct":0.12,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-14","created":"2025-07-14T05:00:00.000Z"},{"totalHome":85.51,"fromGrid":30.55,"fromSolar":38.32,"fromBattery":16.64,"totalSolar":56.96,"toHome":38.32,"toGrid":0.11,"toBattery":18.53,"fromGridPct":35.73,"fromSolarPct":44.81,"fromBatteryPct":19.46,"toHomePct":67.28,"toBatteryPct":32.53,"toGridPct":0.19,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-15","created":"2025-07-15T05:00:00.000Z"},{"totalHome":88.3,"fromGrid":44.49,"fromSolar":34.57,"fromBattery":9.25,"totalSolar":45.45,"toHome":34.57,"toGrid":0.07,"toBattery":10.81,"fromGridPct":50.39,"fromSolarPct":39.15,"fromBatteryPct":10.48,"toHomePct":76.06,"toBatteryPct":23.78,"toGridPct":0.15,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-16","created":"2025-07-16T05:00:00.000Z"},{"totalHome":92.04,"fromGrid":28.57,"fromSolar":44.26,"fromBattery":19.21,"totalSolar":65.29,"toHome":44.26,"toGrid":0.05,"toBattery":20.98,"fromGridPct":31.04,"fromSolarPct":48.09,"fromBatteryPct":20.87,"toHomePct":67.79,"toBatteryPct":32.13,"toGridPct":0.08,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-17","created":"2025-07-17T05:00:00.000Z"},{"totalHome":118.97,"fromGrid":54.28,"fromSolar":48.88,"fromBattery":15.81,"totalSolar":66.41,"toHome":48.88,"toGrid":0.02,"toBattery":17.51,"fromGridPct":45.62,"fromSolarPct":41.09,"fromBatteryPct":13.29,"toHomePct":73.6,"toBatteryPct":26.37,"toGridPct":0.03,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-18","created":"2025-07-18T05:00:00.000Z"},{"totalHome":54.12,"fromGrid":13.65,"fromSolar":28.52,"fromBattery":11.95,"totalSolar":66.49,"toHome":28.52,"toGrid":16.55,"toBattery":21.42,"fromGridPct":25.22,"fromSolarPct":52.7,"fromBatteryPct":22.08,"toHomePct":42.89,"toBatteryPct":32.22,"toGridPct":24.89,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-19","created":"2025-07-19T05:00:00.000Z"},{"totalHome":58.92,"fromGrid":0.93,"fromSolar":35.14,"fromBattery":22.85,"totalSolar":66.17,"toHome":35.14,"toGrid":9.23,"toBattery":21.8,"fromGridPct":1.58,"fromSolarPct":59.64,"fromBatteryPct":38.78,"toHomePct":53.11,"toBatteryPct":32.95,"toGridPct":13.95,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-20","created":"2025-07-20T05:00:00.000Z"},{"totalHome":65.76,"fromGrid":4.6,"fromSolar":39.03,"fromBattery":22.12,"totalSolar":67.12,"toHome":39.03,"toGrid":4.55,"toBattery":23.54,"fromGridPct":7,"fromSolarPct":59.35,"fromBatteryPct":33.64,"toHomePct":58.15,"toBatteryPct":35.07,"toGridPct":6.78,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-21","created":"2025-07-21T05:00:00.000Z"},{"totalHome":61.85,"fromGrid":6.06,"fromSolar":35.7,"fromBattery":20.09,"totalSolar":67.07,"toHome":35.7,"toGrid":10.02,"toBattery":21.35,"fromGridPct":9.8,"fromSolarPct":57.72,"fromBatteryPct":32.48,"toHomePct":53.23,"toBatteryPct":31.83,"toGridPct":14.94,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-22","created":"2025-07-22T05:00:00.000Z"},{"totalHome":67.09,"fromGrid":6.96,"fromSolar":37.58,"fromBattery":22.56,"totalSolar":66.32,"toHome":37.58,"toGrid":4.24,"toBattery":24.5,"fromGridPct":10.37,"fromSolarPct":56.01,"fromBatteryPct":33.63,"toHomePct":56.66,"toBatteryPct":36.94,"toGridPct":6.39,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-23","created":"2025-07-23T05:00:00.000Z"},{"totalHome":62.07,"fromGrid":6.88,"fromSolar":35.4,"fromBattery":19.79,"totalSolar":66.66,"toHome":35.4,"toGrid":9.1,"toBattery":22.16,"fromGridPct":11.08,"fromSolarPct":57.03,"fromBatteryPct":31.88,"toHomePct":53.11,"toBatteryPct":33.24,"toGridPct":13.65,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-24","created":"2025-07-24T05:00:00.000Z"},{"totalHome":61.88,"fromGrid":5.49,"fromSolar":34.35,"fromBattery":22.05,"totalSolar":60.81,"toHome":34.35,"toGrid":2.73,"toBattery":23.73,"fromGridPct":8.87,"fromSolarPct":55.51,"fromBatteryPct":35.63,"toHomePct":56.49,"toBatteryPct":39.02,"toGridPct":4.49,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-25","created":"2025-07-25T05:00:00.000Z"},{"totalHome":62.97,"fromGrid":7.96,"fromSolar":32.71,"fromBattery":22.3,"totalSolar":59.34,"toHome":32.71,"toGrid":0.09,"toBattery":26.54,"fromGridPct":12.64,"fromSolarPct":51.95,"fromBatteryPct":35.41,"toHomePct":55.12,"toBatteryPct":44.73,"toGridPct":0.15,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-26","created":"2025-07-26T05:00:00.000Z"},{"totalHome":92.54,"fromGrid":39.94,"fromSolar":39.61,"fromBattery":12.99,"totalSolar":51.19,"toHome":39.61,"toGrid":0.06,"toBattery":11.52,"fromGridPct":43.16,"fromSolarPct":42.8,"fromBatteryPct":14.04,"toHomePct":77.38,"toBatteryPct":22.5,"toGridPct":0.12,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-27","created":"2025-07-27T05:00:00.000Z"},{"totalHome":98.83,"fromGrid":36.71,"fromSolar":40.63,"fromBattery":21.49,"totalSolar":64.23,"toHome":40.63,"toGrid":0.08,"toBattery":23.52,"fromGridPct":37.14,"fromSolarPct":41.11,"fromBatteryPct":21.74,"toHomePct":63.26,"toBatteryPct":36.62,"toGridPct":0.12,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-28","created":"2025-07-28T05:00:00.000Z"},{"totalHome":110.04,"fromGrid":46.7,"fromSolar":47.47,"fromBattery":15.88,"totalSolar":65.25,"toHome":47.47,"toGrid":0.07,"toBattery":17.71,"fromGridPct":42.44,"fromSolarPct":43.14,"fromBatteryPct":14.43,"toHomePct":72.75,"toBatteryPct":27.14,"toGridPct":0.11,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-29","created":"2025-07-29T05:00:00.000Z"},{"totalHome":113.3,"fromGrid":50.69,"fromSolar":49.4,"fromBattery":13.21,"totalSolar":64.48,"toHome":49.4,"toGrid":0.07,"toBattery":15.01,"fromGridPct":44.74,"fromSolarPct":43.6,"fromBatteryPct":11.66,"toHomePct":76.61,"toBatteryPct":23.28,"toGridPct":0.11,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-30","created":"2025-07-30T05:00:00.000Z"},{"totalHome":115.05,"fromGrid":53.88,"fromSolar":48.38,"fromBattery":12.79,"totalSolar":62.77,"toHome":48.38,"toGrid":0.06,"toBattery":14.33,"fromGridPct":46.83,"fromSolarPct":42.05,"fromBatteryPct":11.12,"toHomePct":77.08,"toBatteryPct":22.83,"toGridPct":0.1,"totalHomePct":100,"totalSolarPct":100,"labels":"Jul-31","created":"2025-07-31T05:00:00.000Z"},{"totalHome":100.05,"fromGrid":45.47,"fromSolar":40.56,"fromBattery":14.01,"totalSolar":56.34,"toHome":40.56,"toGrid":0.07,"toBattery":15.71,"fromGridPct":45.45,"fromSolarPct":40.54,"fromBatteryPct":14,"toHomePct":71.99,"toBatteryPct":27.88,"toGridPct":0.12,"totalHomePct":100,"totalSolarPct":100,"labels":"Aug-1","created":"2025-08-01T05:00:00.000Z"},{"totalHome":81.02,"fromGrid":40.42,"fromSolar":29.14,"fromBattery":11.46,"totalSolar":41.99,"toHome":29.14,"toGrid":0.08,"toBattery":12.77,"fromGridPct":49.89,"fromSolarPct":35.97,"fromBatteryPct":14.14,"toHomePct":69.4,"toBatteryPct":30.41,"toGridPct":0.19,"totalHomePct":100,"totalSolarPct":100,"labels":"Aug-2","created":"2025-08-02T05:00:00.000Z"},{"totalHome":74.46,"fromGrid":36.28,"fromSolar":19.64,"fromBattery":18.54,"totalSolar":40.39,"toHome":19.64,"toGrid":0.12,"toBattery":20.63,"fromGridPct":48.72,"fromSolarPct":26.38,"fromBatteryPct":24.9,"toHomePct":48.63,"toBatteryPct":51.08,"toGridPct":0.3,"totalHomePct":100,"totalSolarPct":100,"labels":"Aug-3","created":"2025-08-03T05:00:00.000Z"},{"totalHome":83.78,"fromGrid":28.64,"fromSolar":37.32,"fromBattery":17.82,"totalSolar":57.18,"toHome":37.32,"toGrid":0.1,"toBattery":19.76,"fromGridPct":34.18,"fromSolarPct":44.55,"fromBatteryPct":21.27,"toHomePct":65.27,"toBatteryPct":34.56,"toGridPct":0.17,"totalHomePct":100,"totalSolarPct":100,"labels":"Aug-4","created":"2025-08-04T05:00:00.000Z"},{"totalHome":66.89,"fromGrid":11.69,"fromSolar":38.45,"fromBattery":16.74,"totalSolar":63.64,"toHome":38.45,"toGrid":0.77,"toBattery":24.42,"fromGridPct":17.48,"fromSolarPct":57.48,"fromBatteryPct":25.03,"toHomePct":60.42,"toBatteryPct":38.37,"toGridPct":1.21,"totalHomePct":100,"totalSolarPct":100,"labels":"Aug-5","created":"2025-08-05T05:00:00.000Z"}]

If ui_control is not an option, is there an alternate approach to dynamically defining a table? Thanks for your help

@omrid - apologies. I should have looked at your sample flows as there is an example there of how to create a table from a function node. Will try out that approach first and hopefully get it to work. Thanks again :folded_hands:t3:

OK. let me know if you have issues. Note that tbCreateTable is not incremental. It destroys the previous table (if existed) before creating the new one.

I would be helpful to take the time and read the on-line help for ui-tabulator in the editor. It describes all the commands, plus many other features you may find helpful.

1 Like

Thanks - I saw that in the documentation. I will have to add some additional logic to do that only when the user selections change (and not when the data changes).

Great job on documenting this - it took me a while to get my head wrapped around the changes from the DB1 ui-table, but I think I’m getting there.