# Referencing view parameters in perspective via scripting

**URL:** <https://forum.inductiveautomation.com/t/referencing-view-parameters-in-perspective-via-scripting/21115>\
**Category:** Ignition Early Access\
**Created:** [November 28, 2018, 4:16pm UTC](https://forum.inductiveautomation.com/t/referencing-view-parameters-in-perspective-via-scripting/21115 "2018-11-28T16:16:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![WildeKurt](https://avatars.discourse-cdn.com/v4/letter/w/50afbb/32.png) [@WildeKurt](https://forum.inductiveautomation.com/u/WildeKurt)\
**Post date:** [November 28, 2018, 4:16pm UTC](https://forum.inductiveautomation.com/t/referencing-view-parameters-in-perspective-via-scripting/21115/1 "2018-11-28T16:16:34Z")

</div>

What is the syntax for referencing a views parameters in an event script. I have a view called Motor which has an view parameter called MotorNumber. I’m trying to set a tag by incorporating this in an event script like this:

```
tp = '[CodeSys]Testing/mtr' + str(self.parent.parent.MotorNumber) + 'StopPB'
system.tag.write(tp,1)

```

This doesn’t cause any errors. If I hard code the path, it works.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 28, 2018, 5:21pm UTC](https://forum.inductiveautomation.com/t/referencing-view-parameters-in-perspective-via-scripting/21115/2 "2018-11-28T17:21:41Z")

</div>

While you are able to use `system.tag.write()` in perspective, you should use `system.tag.writeAsync()` as `system.tag.write()` is essentially deprecated (in your script type out “system.tag.” then hold Ctrl and tap Space to see available methods).

Assuming `self.parent.parent` indeed refers to the View, then you should try one of two ways (which should both do the same thing):

1. `str(self.parent.parent.params.MotorNumber)`

or

1. `str(self.view.params.MotorNumber)`

Option 2 will remove the potential issue which could pop up if you ever move the component into a container at a different level.

Further [documentation](https://docs.inductiveautomation.com/display/DOC80/Perspective+Scripting).
