This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Table of all objects
#1
Hi
How to get table of all objects?
Or better how to obtain table of all objects which doesn't contain a specific tag?
I tried
grp.tag()
grp.tag({})
grp.tag('')
grp.tag(nil)

but with no luck
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
Reply
#2
I think this could be a solution:

Code:
tag = "exclude"
objects = grp.all()
filteredObjects = {}

for _,o in ipairs(objects) do
 if o.tagcache.find(tag) then table.insert(filteredObjects, o) end
end


You can also use db query:

Code:
tag = "exclude"
sqlQuery = 'SELECT * FROM objects WHERE tagcache NOT LIKE "%" .. tag .. "%"'
filteredObjects = db:getall(sqlQuery)

-- if you need a value then you must also decode a value based on datatype
for _, o in ipairs(objects) do
  o.value = knxdatatype.decode(o.datahex, o.datatype)
end
Done is better than perfect
Reply
#3
Thank you. I missed grp.all() exists.
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
Reply


Forum Jump: