11.02.2021, 14:53
(24.07.2020, 06:32)admin Wrote: Here's how to get CSV for alerts:the best solutions is create a csv file and sent via mail, the same for register object
Code:rows = { '"Date/time","Script name","Message"' }
items = db:getall('SELECT * FROM alerts ORDER BY id DESC')
for _, item in ipairs(items) do
datetime = os.date('%c', item.alerttime)
rows[ #rows + 1 ] = string.format('%q,%q,%q',
datetime, item.scriptname, item.alert)
end
csv = table.concat(rows, '\n')