# HOA template script events

**URL:** <https://forum.inductiveautomation.com/t/hoa-template-script-events/33839>\
**Category:** Ignition\
**Created:** [April 10, 2020, 8:06am UTC](https://forum.inductiveautomation.com/t/hoa-template-script-events/33839 "2020-04-10T08:06:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![eccornelsen](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@eccornelsen](https://forum.inductiveautomation.com/u/eccornelsen)\
**Post date:** [April 10, 2020, 8:06am UTC](https://forum.inductiveautomation.com/t/hoa-template-script-events/33839/1 "2020-04-10T08:06:54Z")

</div>

Hi there,

What would be the script events associated for each state of the HOA to write the clicked value to the HOA variable? For example, Hand mouseRelease event → Write value 2 to variable Motor1/HOA…

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

Thanks  
Erik

---

<div class="post-metadata">

**Author:** ![DavidWisely](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/davidwisely/32/10482_2.png) [@DavidWisely](https://forum.inductiveautomation.com/u/DavidWisely)\
**Post date:** [April 10, 2020, 10:40am UTC](https://forum.inductiveautomation.com/t/hoa-template-script-events/33839/2 "2020-04-10T10:40:53Z")

</div>

No scripts needed.  
Just bind the Indicator Value and the Control Value on the component to the Motor1/HOA tag. The Control Value will need to be Bidirectional.

---

<div class="post-metadata">

**Author:** ![eccornelsen](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@eccornelsen](https://forum.inductiveautomation.com/u/eccornelsen)\
**Post date:** [April 10, 2020, 12:25pm UTC](https://forum.inductiveautomation.com/t/hoa-template-script-events/33839/3 "2020-04-10T12:25:27Z")

</div>

thanks @DavidWisely, it worked by binding directly the graphic HOA from the template with the Motor1/HOA, but as this is a Template, they are all pointing to Motor1 instead of Motor{1} like an Indirect Binding.

 ![HOA_template_2](https://us1.discourse-cdn.com/inductiveautomation/original/2X/1/134fae22b550cd7808a349030778dcbc5f88556b.png)

How can I bind the HOA Indirectly so they will point to the correct index?  
Thanks

---

<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 10, 2020, 12:31pm UTC](https://forum.inductiveautomation.com/t/hoa-template-script-events/33839/4 "2020-04-10T12:31:44Z")

</div>

You should pass a tag path into your template (template parameter) and do the indirect binding inside the template with that path.

---

<div class="post-metadata">

**Author:** ![eccornelsen](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@eccornelsen](https://forum.inductiveautomation.com/u/eccornelsen)\
**Post date:** [April 10, 2020, 12:55pm UTC](https://forum.inductiveautomation.com/t/hoa-template-script-events/33839/5 "2020-04-10T12:55:25Z")

</div>

thanks @pturmel

I added the tagpath in the template customer parameters:  
 ![HOA_template_3](https://us1.discourse-cdn.com/inductiveautomation/original/2X/9/9e8f2da8bd9771aba067a7dacc0b5f13c11f4ff5.png)

 ![HOA_template_4](https://us1.discourse-cdn.com/inductiveautomation/original/2X/b/b4dd310cd1eaf02401fba9b316c89b9bdfef537f.png)

but still not binding correctly, what am I missing?

---

<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 10, 2020, 1:11pm UTC](https://forum.inductiveautomation.com/t/hoa-template-script-events/33839/6 "2020-04-10T13:11:10Z")

</div>

For your specific case, you don’t need the tag path, since you are passing a motor number instead. Do your motor tag paths have a space between “Motor” and the number?

When you _ **do** _ pass a tagpath to a template, it typically would be the leading part of the tagpath that would be common to all of the bindings needed within the template. You would **not** have any curly braces within this parameter. Only put those in the indirect bindings themselves.

---

<div class="post-metadata">

**Author:** ![eccornelsen](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@eccornelsen](https://forum.inductiveautomation.com/u/eccornelsen)\
**Post date:** [April 10, 2020, 2:33pm UTC](https://forum.inductiveautomation.com/t/hoa-template-script-events/33839/7 "2020-04-10T14:33:41Z")

</div>

it worked by doing normal indirect tag, with the motor index as parameter, as for the other bindings.

 ![HOA_template_5](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/afe8caa7f5548477085830dedf22c4320a1210b5.png)

 ![HOA_template_6](https://us1.discourse-cdn.com/inductiveautomation/original/2X/5/5646da2cdd7fb1429c396345fecf5ad052585407.png)

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

thanks
