# Component Scripting

**URL:** <https://forum.inductiveautomation.com/t/component-scripting/7166>\
**Category:** General Discussion\
**Created:** [August 29, 2013, 5:27pm UTC](https://forum.inductiveautomation.com/t/component-scripting/7166 "2013-08-29T17:27:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ilikebeer](https://avatars.discourse-cdn.com/v4/letter/i/eb8c5e/32.png) [@ilikebeer](https://forum.inductiveautomation.com/u/ilikebeer)\
**Post date:** [August 29, 2013, 5:27pm UTC](https://forum.inductiveautomation.com/t/component-scripting/7166/1 "2013-08-29T17:27:45Z")

</div>

Thanks again for all the help recently. Project is coming allong.  
Todays question is about scripting. I have a button that when clicked moves several values to tags to be used in tables for a report. These values are dependant on the “Machine Name”, shown as “ID” in the script is the variable that needs to change dependant on the “Machine Dropdown” selection. Is there a way to do this with script

value = event.source.parent.getComponent(‘Machine Dropdown’).selectedStringValue  
system.tag.writeToTag(“ID\_Tooling/Machine\_Name”, value)

Any better suggestion is welcome if i am going about this the wrong way… so wet behind the ears i leave a puddle.

Thanks,

---

<div class="post-metadata">

**Author:** ![adamaustin](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adamaustin](https://forum.inductiveautomation.com/u/adamaustin)\
**Post date:** [August 29, 2013, 9:24pm UTC](https://forum.inductiveautomation.com/t/component-scripting/7166/2 "2013-08-29T21:24:36Z")

</div>

You can concatenate strings will the plus (+) sign:

```auto
value = event.source.parent.getComponent('Machine Dropdown').selectedStringValue
system.tag.writeToTag(value + "_Tooling/Machine_Name", value)
```

But if this is for users to generate reports, you’ll almost certainly want to create a CLIENT tag instead (called, say, “ReportMachine”) and write to that:

```auto
value = event.source.parent.getComponent('Machine Dropdown').selectedStringValue
system.tag.writeToTag("[Client]ReportMachine", value)
```

Now your report queries can bind to the CLIENT tag in your SQL queries, etc.

---

<div class="post-metadata">

**Author:** ![ilikebeer](https://avatars.discourse-cdn.com/v4/letter/i/eb8c5e/32.png) [@ilikebeer](https://forum.inductiveautomation.com/u/ilikebeer)\
**Post date:** [August 30, 2013, 11:34am UTC](https://forum.inductiveautomation.com/t/component-scripting/7166/3 "2013-08-30T11:34:33Z")

</div>

Thanks.  
You guys RULE!!! ![:prayer:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e5a7e3b63facc151ea73e3b45db7bdb3d4bdc316.gif ":prayer:")
