# Assigning Dynamic Tag Paths

**URL:** <https://forum.inductiveautomation.com/t/assigning-dynamic-tag-paths/21762>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [January 9, 2019, 1:58pm UTC](https://forum.inductiveautomation.com/t/assigning-dynamic-tag-paths/21762 "2019-01-09T13:58:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brendan.curran](https://avatars.discourse-cdn.com/v4/letter/b/cdc98d/32.png) [@brendan.curran](https://forum.inductiveautomation.com/u/brendan.curran)\
**Post date:** [January 9, 2019, 1:58pm UTC](https://forum.inductiveautomation.com/t/assigning-dynamic-tag-paths/21762/1 "2019-01-09T13:58:05Z")

</div>

Is there a way to assign an OPC path to a tag via scripting. I currently have pointers that will direct to a location in the PLC. However, importing all these OPC tags is not a good option (would have to import over 200k tags) I’d like to have OPC locations update when the pointer updates, but I can’t figure out any way to assign a new OPC path to the tags via scripting.

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [January 9, 2019, 2:08pm UTC](https://forum.inductiveautomation.com/t/assigning-dynamic-tag-paths/21762/2 "2019-01-09T14:08:00Z")

</div>

I would think you should be able to do that with the [system.tag.editTag](https://docs.inductiveautomation.com/display/DOC79/system.tag.editTag) function or for doing multiple at once [system.tag.editTags](https://docs.inductiveautomation.com/display/DOC79/system.tag.editTags). The first example in system.tag.editTag shows how to set an OPC path. You’d just have to build the script to fill it in based on what you want it set to.

---

<div class="post-metadata">

**Author:** ![brendan.curran](https://avatars.discourse-cdn.com/v4/letter/b/cdc98d/32.png) [@brendan.curran](https://forum.inductiveautomation.com/u/brendan.curran)\
**Post date:** [January 9, 2019, 2:21pm UTC](https://forum.inductiveautomation.com/t/assigning-dynamic-tag-paths/21762/3 "2019-01-09T14:21:48Z")

</div>

I tried using that but I just get the following errors:

Error executing script.  
Traceback (most recent call last):  
File “tagevent:valueChanged”, line 5, in valueChanged  
at com.inductiveautomation.ignition.gateway.sqltags.SQLTagsManagerImpl.editTags(SQLTagsManagerImpl.java:978)

```
at com.inductiveautomation.ignition.gateway.script.ialabs.IALabsTagFunctions._editTags(IALabsTagFunctions.java:848)

at com.inductiveautomation.ignition.gateway.script.ialabs.IALabsTagFunctions.__editTags(IALabsTagFunctions.java:800)

at com.inductiveautomation.ignition.gateway.script.ialabs.IALabsTagFunctions.editTagImpl(IALabsTagFunctions.java:684)

at com.inductiveautomation.ignition.common.script.builtin.ialabs.AbstractIALabsTagFunctions.editTag(AbstractIALabsTagFunctions.java:58)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)
```

---

<div class="post-metadata">

**Author:** ![brendan.curran](https://avatars.discourse-cdn.com/v4/letter/b/cdc98d/32.png) [@brendan.curran](https://forum.inductiveautomation.com/u/brendan.curran)\
**Post date:** [January 9, 2019, 2:48pm UTC](https://forum.inductiveautomation.com/t/assigning-dynamic-tag-paths/21762/4 "2019-01-09T14:48:39Z")

</div>

I got it to work. Apparently you need to copy the tag path directly. Selecting the tag path via the client results in this error.
