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.

Rewrite by tag
#1
Hi, is it possible to get values from multiple group addresses by tag, and write back the same values to the group address?
Reply
#2
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
Reply
#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

TNX Smile
Reply
#4
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
Reply
#5
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
Reply


Forum Jump: