# Data Passing from one tag to another

**URL:** <https://forum.inductiveautomation.com/t/data-passing-from-one-tag-to-another/69836>\
**Category:** General Discussion\
**Created:** [February 14, 2023, 3:38pm UTC](https://forum.inductiveautomation.com/t/data-passing-from-one-tag-to-another/69836 "2023-02-14T15:38:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lau\_Kar\_Hei](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@Lau\_Kar\_Hei](https://forum.inductiveautomation.com/u/Lau_Kar_Hei)\
**Post date:** [February 14, 2023, 3:38pm UTC](https://forum.inductiveautomation.com/t/data-passing-from-one-tag-to-another/69836/1 "2023-02-14T15:38:10Z")

</div>

Hi guys.  
I want to mass writing all my source tags (200 tags) value to destination tags (200 tags) value with 5 second interval cycle. The tags all are OPC tags.  
Is there any way I can do it using Transaction group to do this data passing without storing any values inside my database?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 14, 2023, 3:49pm UTC](https://forum.inductiveautomation.com/t/data-passing-from-one-tag-to-another/69836/2 "2023-02-14T15:49:05Z")

</div>

Use a script. Read all the values in one call to `system.tag.readBlocking()`, then write them all to the other tags with one call to `system.tag.writeBlocking()`.

Consider using a project script module top-level variable to hold the two lists of tag paths as static values.

---

<div class="post-metadata">

**Author:** ![Lau\_Kar\_Hei](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@Lau\_Kar\_Hei](https://forum.inductiveautomation.com/u/Lau_Kar_Hei)\
**Post date:** [February 14, 2023, 4:18pm UTC](https://forum.inductiveautomation.com/t/data-passing-from-one-tag-to-another/69836/3 "2023-02-14T16:18:47Z")

</div>

I have tried out this way, but if I do 3 set of it (Total of 600 source tags to 600 destination tags and each set is 200 tags) the write speed will takes long time (10-15s) and it will also affecting my another tag event script using valueChanged under different UDTs.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 14, 2023, 4:23pm UTC](https://forum.inductiveautomation.com/t/data-passing-from-one-tag-to-another/69836/4 "2023-02-14T16:23:55Z")

</div>

> [@Lau\_Kar\_Hei](#):
>
> another tag event script using valueChanged

Don't use tag event scripts for this. Use a gateway timer event (part of the project) that runs every five seconds. That scripts reads all of your tags in bulk, then writes them in bulk, in the project script subsystem. (It doesn't interfere with tag events on the tag).

By "in bulk", I mean you provide a list of tagpaths to the read and write operations. **No Looping**.

In a project script, named `tagCopy`, perhaps:

```auto
# Top level lists of tagpaths
readPaths = ['[default]first/read/tag/path',
	'[default]second/read/tag/path',
	'[default]second/read/tag/path']

writePaths = ['[default]first/write/tag/path',
	'[default]second/write/tag/path',
	'[default]second/write/tag/path']

# The above lists are effectively constants
# This function does the work efficiently
def myCopyEvent():
	qValues = system.tag.readBlocking(readPaths)
	system.tag.writeBlocking(writePaths, qValues)

```

Then, in your Timer Event, you have the one-liner:

```auto
tagCopy.myCopyEvent()

```

---

<div class="post-metadata">

**Author:** ![Lau\_Kar\_Hei](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@Lau\_Kar\_Hei](https://forum.inductiveautomation.com/u/Lau_Kar_Hei)\
**Post date:** [February 17, 2023, 11:20am UTC](https://forum.inductiveautomation.com/t/data-passing-from-one-tag-to-another/69836/5 "2023-02-17T11:20:33Z")

</div>

How does this script deal with bad quality tagpath on the readPaths?

Will it trigger many error and cause a timeout to happen causing gateway performance to degrade?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [February 17, 2023, 12:21pm UTC](https://forum.inductiveautomation.com/t/data-passing-from-one-tag-to-another/69836/6 "2023-02-17T12:21:52Z")

</div>

> [@Lau\_Kar\_Hei](#):
>
> Will it trigger many error and cause a timeout to happen causing gateway performance to degrade?

No. It just returns bad quality for the tag value.
