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.

Delete object logs from script
#15
Try this:
Code:
rows = db:getall([[
  SELECT ol.id, ol.datahex, o.datatype
  FROM objectlog ol
  JOIN objects o ON ol.address=o.id
]])

for _, row in ipairs(rows) do
  if row.datahex then
    value = busdatatype.decode(row.datahex, row.datatype)

    if type(value) == 'number' and value <= 0 then
      db:delete('objectlog', { id = row.id })
    end
  end
end
Reply


Messages In This Thread
Delete object logs from script - by Mirco - 17.05.2017, 15:01
RE: Delete object logs from script - by Mirco - 18.05.2017, 06:11
RE: Delete object logs from script - by admin - 18.05.2017, 05:58
RE: Delete object logs from script - by admin - 18.05.2017, 07:38
RE: Delete object logs from script - by Mirco - 18.05.2017, 08:47
RE: Delete object logs from script - by admin - 26.07.2021, 10:16
RE: Delete object logs from script - by admin - 01.09.2021, 09:13
RE: Delete object logs from script - by admin - 01.09.2021, 12:08
RE: Delete object logs from script - by admin - 01.09.2021, 12:37

Forum Jump: