# Dynamic string path for mouse action

**URL:** <https://forum.inductiveautomation.com/t/dynamic-string-path-for-mouse-action/69453>\
**Category:** Ignition\
**Tags:** ignition81, vision, perspective\
**Created:** [February 4, 2023, 10:23pm UTC](https://forum.inductiveautomation.com/t/dynamic-string-path-for-mouse-action/69453 "2023-02-04T22:23:11Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![p.srikanth0707](https://avatars.discourse-cdn.com/v4/letter/p/e47774/32.png) [@p.srikanth0707](https://forum.inductiveautomation.com/u/p.srikanth0707)\
**Post date:** [February 4, 2023, 10:23pm UTC](https://forum.inductiveautomation.com/t/dynamic-string-path-for-mouse-action/69453/1 "2023-02-04T22:23:11Z")

</div>

Hello folks,

I am trying to set the value in my OPC dynamic tag using this script, getting error 'Bad Not Found'.  
my tag path is correct and tag value quality is good but not sure how to achieve this.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/4/349fbd22f55f47469092728348ccc93e744b6b14.png)

Thanks

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [February 4, 2023, 10:26pm UTC](https://forum.inductiveautomation.com/t/dynamic-string-path-for-mouse-action/69453/2 "2023-02-04T22:26:10Z")

</div>

Try without the _.value_

---

<div class="post-metadata">

**Author:** ![p.srikanth0707](https://avatars.discourse-cdn.com/v4/letter/p/e47774/32.png) [@p.srikanth0707](https://forum.inductiveautomation.com/u/p.srikanth0707)\
**Post date:** [February 4, 2023, 10:27pm UTC](https://forum.inductiveautomation.com/t/dynamic-string-path-for-mouse-action/69453/3 "2023-02-04T22:27:09Z")

</div>

same issue @JordanCClark

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [February 4, 2023, 10:29pm UTC](https://forum.inductiveautomation.com/t/dynamic-string-path-for-mouse-action/69453/4 "2023-02-04T22:29:15Z")

</div>

Have you tried copying the tag path directly, and see if there are any differences?

---

<div class="post-metadata">

**Author:** ![p.srikanth0707](https://avatars.discourse-cdn.com/v4/letter/p/e47774/32.png) [@p.srikanth0707](https://forum.inductiveautomation.com/u/p.srikanth0707)\
**Post date:** [February 4, 2023, 10:30pm UTC](https://forum.inductiveautomation.com/t/dynamic-string-path-for-mouse-action/69453/5 "2023-02-04T22:30:10Z")

</div>

Tag path is commented in the script, it is exactly same

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [February 4, 2023, 10:30pm UTC](https://forum.inductiveautomation.com/t/dynamic-string-path-for-mouse-action/69453/6 "2023-02-04T22:30:32Z")

</div>

Never mind. Don't use _tag_ as a string when you try to write to it. 😉

---

<div class="post-metadata">

**Author:** ![p.srikanth0707](https://avatars.discourse-cdn.com/v4/letter/p/e47774/32.png) [@p.srikanth0707](https://forum.inductiveautomation.com/u/p.srikanth0707)\
**Post date:** [February 4, 2023, 10:30pm UTC](https://forum.inductiveautomation.com/t/dynamic-string-path-for-mouse-action/69453/7 "2023-02-04T22:30:38Z")

</div>

Is there any other way to do this?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [February 4, 2023, 10:31pm UTC](https://forum.inductiveautomation.com/t/dynamic-string-path-for-mouse-action/69453/8 "2023-02-04T22:31:24Z")

</div>

```python
system.tag.writeBlocking(tag, 1)

```

Notice no quotes.

---

<div class="post-metadata">

**Author:** ![p.srikanth0707](https://avatars.discourse-cdn.com/v4/letter/p/e47774/32.png) [@p.srikanth0707](https://forum.inductiveautomation.com/u/p.srikanth0707)\
**Post date:** [February 4, 2023, 10:32pm UTC](https://forum.inductiveautomation.com/t/dynamic-string-path-for-mouse-action/69453/9 "2023-02-04T22:32:14Z")

</div>

in my case all my tags are string like ,

CCV01  
CDC01  
CDR02

example it shows only Motor1,2,3,-----etc  
in my case it must be dynamic string value

---

<div class="post-metadata">

**Author:** ![p.srikanth0707](https://avatars.discourse-cdn.com/v4/letter/p/e47774/32.png) [@p.srikanth0707](https://forum.inductiveautomation.com/u/p.srikanth0707)\
**Post date:** [February 4, 2023, 10:36pm UTC](https://forum.inductiveautomation.com/t/dynamic-string-path-for-mouse-action/69453/10 "2023-02-04T22:36:43Z")

</div>

Awesome, thanks you are correct @JordanCClark

there is one small correction in my script as it is binding from the container,

#Valve =1

Tagpath1 = "[default]Test/"  
Tagpath2 = "{event.source.parent.Valve}"  
Tagpath3 = "/Cmd.value"

tag = Tagpath1+Tagpath2+Tagpath3

#system.tag.writeBlocking(["[default]Test/+[str(event.source.parent.Valve)]+/Cmd.value"], [1])

system.tag.writeBlocking(tag, 1)

print(tag)

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [February 4, 2023, 10:40pm UTC](https://forum.inductiveautomation.com/t/dynamic-string-path-for-mouse-action/69453/11 "2023-02-04T22:40:26Z")

</div>

You can shorten the tagPath to one line using a format method.

```python
tag = "[default]Test/{}//Cmd.value".format(event.source.parent.Valve)

```
