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.

Writing to multiple objects
#1
Hello

Is there a way for me to write for example a "3" to several objects in one script? Se attatchment.
Let say I tag all the objects I want to adress with "Modus", and I want to write this if another object (Lets say 32/0/3) is "True".

Attached Files Thumbnail(s)
   
Reply
#2
Like this:
Code:
objs = grp.tag('my_tag')
objs:write(123)
Reply
#3
Why won't it write the value of the group-adress 32/1/10 to tag "Modus"?

Attached Files Thumbnail(s)
   
Reply
#4
This is wrong. You should add tag 'Modus' to object 32/1/10 and instead of the address in your script put a value you want to write. If you want to write to single object then use single command.
------------------------------
Ctrl+F5
Reply
#5
But the value i want to write comes from group-adress 32/1/10

I am trying to write the value that 32/1/10 holds to all objects with the tag "Modus".

The value 32/1/10 is being written from a PLC via BACnet.
Reply
#6
Do it like this
Code:
value = grp.getvalue('32/1/10')
objs = grp.tag('Modus')
objs:write(value)
------------------------------
Ctrl+F5
Reply
#7
Then you need an event script, not a resident script:
Code:
value = event.getvalue()
objs = grp.tag('Modus')
objs:write(value)
Reply
#8
christian.troen@haaland.no

Hi.
 
In the heading you write that you want all object with tag "Modus", to recive the value of "3" if (32/0/3) is True. If this is still what you want, then you can use this as Event-based script.
This sends the value "3" to all "Modus" taged objects, but only when 32/0/3 gets True.
 
Code:
value = event.getvalue()
objs = grp.tag('Modus')
if value == true then objs:write(3)
end

 
BR
Kai-Roger
Reply


Forum Jump: