How to sort data
Posted: Sunday 10 July 2022 14:13
Hi,
I have got variable "online":
There are data like this (added by add command):
aaa, ccc, bbb, eee, ddd
Is it possible to sort it alphabetically or rewrite alphabetically to another data variable?
I will just add that aaa, bbb ..... are the names of Domoticz devices that are getting according to criteria determined by the command:
And i want to print it out alphabetically .
I will be grateful for your help.
Tom
I have got variable "online":
Code: Select all
data = { online = { initial = {}, history = true, maxItems = 20 }}.
aaa, ccc, bbb, eee, ddd
Is it possible to sort it alphabetically or rewrite alphabetically to another data variable?
I will just add that aaa, bbb ..... are the names of Domoticz devices that are getting according to criteria determined by the command:
Code: Select all
domoticz.devices().forEach(function(device)
if string.match(device.name, ' .* PINGER') ~= nil then
domoticz.data.online.add(string.match(device.name, "(%w+) "))
end
end)
I will be grateful for your help.
Tom