leeroy
April 14, 2019, 4:06pm
1
Hi,
I have tags that i want to write to other tags with a button… the scipt is on the action performed
[CODE]
tags = ["[Master_par_Tags]Batching/A220/AGT SPT/AGT1/SPT_1_","[Master_par_Tags]Batching/A220/AGT SPT/AGT1/SPT_2_"]
values = ["[Master_par_Tags]Batching/A220/AGT SPT/AGT1_MEM/SPT_1_M","[Master_par_Tags]Batching/A220/AGT SPT/AGT1_MEM/SPT_2_M"]
values = system.tag.writeAll(tags,values)
[CODE/]
Problem is for some reason it’s not working like that but when i use(the following script)it’s working fine.Can we use tags as value for this? or it has to be hard coded values ?
Thanks
[CODE]
tags = ["[Master_par_Tags]Batching/A220/AGT SPT/AGT1/SPT_1_","[Master_par_Tags]Batching/A220/AGT SPT/AGT1/SPT_2_"]
values = [150,102]
values = system.tag.writeAll(tags,values)
[CODE/]
You need to read the values from the other tags whose values you want with system.tag.readAll
(and get the .value
out of the QualifiedValue
you get).
leeroy
April 14, 2019, 4:51pm
3
so I need to do for exemple
tagsr = ["[Master_par_Tags]Batching/A220/AGT SPT/AGT1_MEM/SPT_1_M","[Master_par_Tags]Batching/A220/AGT SPT/AGT1_MEM/SPT_2_M"]
valuesr = system.tag.readAll(tagsr)
and then what ? sorry for the newbie question i’m new to scripting …
leeroy
April 14, 2019, 5:12pm
4
I finaly found the solution
tagsr = ["[Master_par_Tags]Batching/A220/AGT SPT/AGT1_MEM/SPT_1_M","[Master_par_Tags]Batching/A220/AGT SPT/AGT1_MEM/SPT_2_M"]
valuesr = system.tag.readAll(tagsr)
tags = ["[Master_par_Tags]Batching/A220/AGT SPT/AGT1/SPT_1_","[Master_par_Tags]Batching/A220/AGT SPT/AGT1/SPT_2_"]
values = [valuesr[0].value,valuesr[1].value]
values = system.tag.writeAll(tags,values)
Thanks for your help