Logic Machine Forum
Rewrite by tag - 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: Rewrite by tag (/showthread.php?tid=3580)



Rewrite by tag - Stuart2000 - 23.09.2021

Hi, is it possible to get values from multiple group addresses by tag, and write back the same values to the group address?


RE: Rewrite by tag - admin - 24.09.2021

I suppose you want to write back the same values to bus for certain tagged objects periodically. If so create a scheduled script and change the tag name as needed:
Code:
objects = grp.tag('my_tag_name')
for _, object in ipairs(objects) do
  object:write(object.value)
end



RE: Rewrite by tag - Stuart2000 - 24.09.2021

(24.09.2021, 07:07)admin Wrote: I suppose you want to write back the same values to bus for certain tagged objects periodically. If so create a scheduled script and change the tag name as needed:
Code:
objects = grp.tag('my_tag_name')
for _, object in ipairs(objects) do
  object:write(object.value)
end

TNX Smile


RE: Rewrite by tag - Stuart2000 - 13.06.2022

Is it possible to only rewrite value 3 if the value is 3?
(24.09.2021, 07:07)admin Wrote: I suppose you want to write back the same values to bus for certain tagged objects periodically. If so create a scheduled script and change the tag name as needed:
Code:
objects = grp.tag('my_tag_name')
for _, object in ipairs(objects) do
  object:write(object.value)
end



RE: Rewrite by tag - admin - 13.06.2022

Use this:
Code:
objects = grp.tag('my_tag_name')
for _, object in ipairs(objects) do
  if object.value == 3 then
    object:write(object.value)
  end
end