Create table within another table - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Create table within another table (/showthread.php?tid=2772) |
Create table within another table - Carlos Padilla - 03.08.2020 Good companion. I hope they are excellent. My question is this. It is possible to create a table within another table as you will see in the image that I attach. I want to create a parent table that will be "climate profiles" and within this, the user can create create different tables such as "comfort" with different settings as if the user wants to turn on the air, what is the temperature you want configure, fan mode etc. The idea is that I can have several tables such as Climate profiles, Occupation profiles, curtain profiles, etc., but that the client can add internal tables and configure what they want. This information should ideally be stored in the storage. Currently I have been able to store tables but independent, but not tables within tables as seen in the image. Thank you for your cooperation. RE: Create table within another table - Erwin van der Zwart - 03.08.2020 Hi, That is rather easy to do: mytable = { mysecondtable = { mythirttable = { final = 'end' } } } Code: --or add afterwards Code: profiles = { BR, Erwin RE: Create table within another table - Carlos Padilla - 04.08.2020 Hi Erwin, thanks for responding and for your help. I tried what you told me and it worked. Now, I want the same user to be the one to put the names to each subtable that will be a profile so that it can be stored and managed. I tried to use the .. to concatenate it, but it gives me a syntax error. I enclose the code to see where I am going wrong. Thank you and I will be attentive. Code: Nombre_modo = grp.getvalue('32/1/21') RE: Create table within another table - Erwin van der Zwart - 04.08.2020 Hi, Try this (enclose what you want in [ ... ] ): Code: Nombre_modo = grp.getvalue('32/1/21') Sample: Code: Nombre_modo = grp.getvalue('32/1/21') -- lets assume this holds value 'Test' Erwin RE: Create table within another table - Carlos Padilla - 10.08.2020 Hello Erwin, thanks for answering, with your help I have been able to progress to store and even obtain a part of the table (Conf) and pass it to a Group address without having to touch the other tables (mysecondtable). My question is if I can delete one of the subtables, without having to delete the parent table ´Perfiles Climas´ or the other child table mysecondtable. I have used this code and others, but modifying it, but it did not work for me and even in some it generates an error. Code: Nombre_modo = grp.getvalue('32/1/21') Some errors are: Event for Pruebas Storage (32/1/20) 10.08.2020 17:52:58 Library genohm-scada:0: attempt to call method 'sub' (a nil value) stack traceback: Library genohm-scada: in function '' Library genohm-scada: in function 'delete' User script:21: in main chunk I clarify that in the communication object is the name of ´Conf´ which is the table I want to eliminate. Thank you RE: Create table within another table - Erwin van der Zwart - 11.08.2020 Hi, What you can do is this: Code: Nombre_modo = grp.getvalue('32/1/21') Erwin |