Logic Machine Forum
Get list of objects - 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: Get list of objects (/showthread.php?tid=2157)



Get list of objects - Trond Hoyem - 16.07.2019

Hi

I have a need to get a list of objects inside the SL/LM based on the main group. What I would like to do is make a query for all objects in main group 0.

I have tried some different SQL lookup, but due to my restricte knowledge of SQL I am not able to get a list based on the group address, only based on the name. Anyone have a tip how to proceed?

What I have done so far is:
Code:
liste = db:getall('SELECT address FROM objects WHERE name LIKE "%lys set value%"') -- returns a list with all objects containing this string
liste = db:getall('SELECT address FROM objects WHERE address LIKE "%0/0%"') -- returns empty list, as the address in the SQL table seems to be a number, not a string.



RE: Get list of objects - admin - 16.07.2019

You need to query WHERE id BETWEEN 1 AND 2047
This will get all objects between 0/0/1 and 0/7/255


RE: Get list of objects - Trond Hoyem - 16.07.2019

Ah, Ok. Will do that.

So that means I need to calculate the different values for the different main groups?

The reason I need this is that in one project we have 30 SL's, and in each we only want to have certain main groups available due to capasity. I then need to create a script that automatically delete the not wanted objects once a day or something.


RE: Get list of objects - admin - 16.07.2019

You can disable bus sniffer in main configuration. This will stop new objects from appearing.
Group address is 2 bytes split into parts as 5/3/8 bits.


RE: Get list of objects - Trond Hoyem - 16.07.2019

(16.07.2019, 11:39)admin Wrote: You can disable bus sniffer in main configuration. This will stop new objects from appearing.
Group address is 2 bytes split into parts as 5/3/8 bits.

Yeah, I know about the bus sniffer, but in this case we have a large ETS project, and we only want one part of the project in each SL. So I want to just import the complete ESF-file and then just let the script delete what I do not need. The script can then just run once a day to make sure any new import is also cleaned up.

Trond