# Move drop down list values to a memory tags from a template

**URL:** <https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [April 23, 2020, 12:33pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152 "2020-04-23T12:33:23Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhicks1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mhicks1/32/14121_2.png) [@mhicks1](https://forum.inductiveautomation.com/u/mhicks1)\
**Post date:** [April 23, 2020, 12:33pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/1 "2020-04-23T12:33:23Z")

</div>

Good Morning. I am trying to move a selected string that I have chosen from a drop down list and moved to a Text Field. All of this is inside of a template.

I want to move the value to the memory tag that coincides with the BD number of the template.

In the template, there is a Template Property “bdName” that I have used throughout the project.

On my Accept button, in the script editor there is system.tag.writeBlocking function that I cant get to work. The following error comes up when theAccept button is pressed.

Anyone doing this in a template that can provide a suggestion?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/b/bfc99433bbb2c1a29c404184171bc48413fc00a7.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/8/8c456b6e7caa9c3d5f582c0f5df8084fd98bccc9.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/b/bdaf90318903e869a419fd155de6bb095e1f33a3.png)

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [April 23, 2020, 12:37pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/2 "2020-04-23T12:37:55Z")

</div>

your tag you are building up in the system.tag.writeBlock isn’t quite formatted correctly.

do something like this:

```auto
['[default]Ohio MHicks/CI 19-133/Box Dumper/Material/BD' + toStr(event.source.parent.bdNum)]

```

Then the bdNum custom property is properly added to the tagPath

---

<div class="post-metadata">

**Author:** ![mhicks1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mhicks1/32/14121_2.png) [@mhicks1](https://forum.inductiveautomation.com/u/mhicks1)\
**Post date:** [April 23, 2020, 12:48pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/3 "2020-04-23T12:48:32Z")

</div>

I made the modification and then got this error. Should there be something in the [value]?  
I looked through the IAU for some help on this but no luck. Thank you for helping me out…

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

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [April 23, 2020, 12:57pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/4 "2020-04-23T12:57:59Z")

</div>

Post your raw code using the triple quotes so I can take a look at it.

---

<div class="post-metadata">

**Author:** ![mhicks1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mhicks1/32/14121_2.png) [@mhicks1](https://forum.inductiveautomation.com/u/mhicks1)\
**Post date:** [April 23, 2020, 1:03pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/5 "2020-04-23T13:03:06Z")

</div>

I am pretty new to Ignition. I am not sure what you mean by raw code.  
Everything I am using for my Accept button is in the script editor snip above.  
Sorry for be so green at this 🙂

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [April 23, 2020, 1:04pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/6 "2020-04-23T13:04:45Z")

</div>

Just copy your code in the actionPerformed event and post it here. It’s easier to see what you are trying to do.

when you do post it here start and end the code with ``` so it is properly formatted.

Don’t worry… everyone was new at one point.

---

<div class="post-metadata">

**Author:** ![mhicks1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mhicks1/32/14121_2.png) [@mhicks1](https://forum.inductiveautomation.com/u/mhicks1)\
**Post date:** [April 23, 2020, 1:28pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/7 "2020-04-23T13:28:30Z")

</div>

I am using the Set Value tag tab in the Event Handler. as shown below. I am not writing any code per say. The snip below works well but it only writes to one tag. I am trying to use bdNum in place of the Highlighted 408 in the snip.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/2/2acb92f7135a270c671c5a8db89353d779e1eba9.png)

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [April 23, 2020, 1:31pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/8 "2020-04-23T13:31:01Z")

</div>

Copy the code from the script editor.

The Set Tag Value code creates that code. Since you are trying to do something a little out of the normal then we need to modify that code.

Alternatively you can create a custom property that indirectly references your desired tag and write to that.

---

<div class="post-metadata">

**Author:** ![mhicks1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mhicks1/32/14121_2.png) [@mhicks1](https://forum.inductiveautomation.com/u/mhicks1)\
**Post date:** [April 23, 2020, 1:33pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/9 "2020-04-23T13:33:29Z")

</div>

Thats where I was trying to use bdNum in place of 408 as shown below.  
It seems like it should have worked…

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/3/35b0fab4cfbacd93cf7c87270a86b9af903005c3.png)

---

<div class="post-metadata">

**Author:** ![mhicks1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mhicks1/32/14121_2.png) [@mhicks1](https://forum.inductiveautomation.com/u/mhicks1)\
**Post date:** [April 23, 2020, 1:35pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/10 "2020-04-23T13:35:48Z")

</div>

“”“value = event.source.parent.getComponent(‘BD Material’).text”""

“”“system.tag.writeBlocking([’[default]Ohio MHicks/CI 19-133/Box Dumper/Material/BDevent.source.parent.bdNum’], [value])”""

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [April 23, 2020, 1:40pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/11 "2020-04-23T13:40:11Z")

</div>

OK… so this is how that need to look:

```auto
value = event.source.parent.getComponent('BD Material').text

system.tag.writeBlocking(['[default]Ohio MHicks/CI 19-133/Box umper/Material/BD' + toStr(event.source.parent.bdNum)], [value])

```

Alternatively you can do this so see what is happening. The print will show up in the console. That way you can check the tag that is being created to make sure it looks correct.

```auto
value = event.source.parent.getComponent('BD Material').text
tagPath = '[default]Ohio MHicks/CI 19-133/Box umper/Material/BD' + toStr(event.source.parent.bdNum)
print 'tagPath: %s' %tagPath
system.tag.writeBlocking([tagPath], [value])

```

BTW the triple quote are these: ```

---

<div class="post-metadata">

**Author:** ![mhicks1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mhicks1/32/14121_2.png) [@mhicks1](https://forum.inductiveautomation.com/u/mhicks1)\
**Post date:** [April 23, 2020, 1:50pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/12 "2020-04-23T13:50:52Z")

</div>

LOL. 3 apostrophes are a triple quote. Thanks…  
I think that is what you suggested originally. I put it in the script Console and this is what I get

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/c/cb68d7aa3507e06790a79f7645c8243ff05d3601.png)

Thanks again for your time helping me…

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [April 23, 2020, 1:54pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/13 "2020-04-23T13:54:50Z")

</div>

So that won’t work in the Script Console.

What I meant was the output console of either runtime or the designer.

Copy that script into the script editor portion of your actionPerformed on your button and let me know what happens.

---

<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:** [April 23, 2020, 2:08pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/14 "2020-04-23T14:08:09Z")

</div>

Uhm, `toStr()` is not python. That is a function used in expression bindings. In python, use `str()`. The error is visible in the original screenshot.

You also need to obtain `bdNum` from somewhere.

---

<div class="post-metadata">

**Author:** ![mhicks1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mhicks1/32/14121_2.png) [@mhicks1](https://forum.inductiveautomation.com/u/mhicks1)\
**Post date:** [April 23, 2020, 2:08pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/15 "2020-04-23T14:08:56Z")

</div>

Here is what I had in the script console and also what the Output Console showed.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/0/005c9e98e5cd97390658e7d6a49249f09a730356.png)

10:05:51.090 [AWT-EventQueue-0] ERROR com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter - Error executing script for event:&nbsp;`actionPerformed`  
on component:&nbsp;`Accept Button`.  
com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last):  
File “event:actionPerformed”, line 13, in   
NameError: name ‘toStr’ is not defined

```
at org.python.core.Py.NameError(Py.java:290)
at org.python.core.PyFrame.getname(PyFrame.java:257)
at org.python.pycode._pyx304.f$0(<event:actionPerformed>:15)
at org.python.pycode._pyx304.call_function(<event:actionPerformed>)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1614)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:761)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:187)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:278)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:57)
at com.sun.proxy.$Proxy62.actionPerformed(Unknown Source)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.desktop/java.awt.Component.processEvent(Unknown Source)
at java.desktop/java.awt.Container.processEvent(Unknown Source)
at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

```

Caused by: org.python.core.PyException: Traceback (most recent call last):  
File “event:actionPerformed”, line 13, in   
NameError: name ‘toStr’ is not defined

---

<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:** [April 23, 2020, 2:11pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/16 "2020-04-23T14:11:46Z")

</div>

> [@mhicks1](#):
>
> NameError: name ‘toStr’ is not defined

`toStr()` is not defined because it is not python. See my prior comment.

---

<div class="post-metadata">

**Author:** ![mhicks1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mhicks1/32/14121_2.png) [@mhicks1](https://forum.inductiveautomation.com/u/mhicks1)\
**Post date:** [April 23, 2020, 2:16pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/17 "2020-04-23T14:16:17Z")

</div>

OK. I changed" toStr" to str and got the following message.  
Illegal “+” Shoul dthat be eliminated?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/f519428b0182e71febc5aecbf3f7f62fb6ec18b0.png)

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [April 23, 2020, 2:20pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/18 "2020-04-23T14:20:55Z")

</div>

Oh man. I’ve not had enough coffee @pturmel  
OK… sorry.

get rid of everyting in that sript block and put this in

```auto
 value = event.source.parent.getComponent('BD Material').text

system.tag.writeBlocking(['[default]Ohio MHicks/CI 19-133/Box Dumper/Material/BD' + str(event.source.parent.bdNum)], [value])

```

---

<div class="post-metadata">

**Author:** ![mhicks1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mhicks1/32/14121_2.png) [@mhicks1](https://forum.inductiveautomation.com/u/mhicks1)\
**Post date:** [April 23, 2020, 2:27pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/19 "2020-04-23T14:27:46Z")

</div>

You guys are awesome!!! That worked. I hope to help others out like this someday…  
Thanks again!!!

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [April 23, 2020, 2:28pm UTC](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152/20 "2020-04-23T14:28:12Z")

</div>

Not a problem. Sorry about all the confusion. Need more coffee.

Good luck!

[Next page](https://forum.inductiveautomation.com/t/move-drop-down-list-values-to-a-memory-tags-from-a-template/34152.md?page=2)
