Assigning Dynamic Tag Paths

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.

I would think you should be able to do that with the system.tag.editTag function or for doing multiple at once 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.

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)

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.