# Scripting question with custom property

**URL:** <https://forum.inductiveautomation.com/t/scripting-question-with-custom-property/37484>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [August 6, 2020, 11:09pm UTC](https://forum.inductiveautomation.com/t/scripting-question-with-custom-property/37484 "2020-08-06T23:09:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![trishadx](https://avatars.discourse-cdn.com/v4/letter/t/eb9ed0/32.png) [@trishadx](https://forum.inductiveautomation.com/u/trishadx)\
**Post date:** [August 6, 2020, 11:09pm UTC](https://forum.inductiveautomation.com/t/scripting-question-with-custom-property/37484/1 "2020-08-06T23:09:00Z")

</div>

Hi guys, could someone please point out where I’m going wrong. my scripting skills are far from intermediate…

I’m trying to make a component change its visibility depending on if an alarm is active for that tag or not, on vision’s designer. But as this pop up window/screen has a custom property that would show the same properties but of different “motors” (i.e. motor 1, motor 2, depending on a previous selection), ive written the following where the ID should take the tag name, pop it in a string for the tag path.

however im getting a synthax error for line 1, char 4…the equals sign?

```auto
ID = {Root Container.Motor_Reference::Belt_ID}
tag = '[default]Motor_ID/*/%s' % (ID)
if (isAlarmActive(tag) = 1,visible=1)

```

I’m super stomped. sorry guys

but thank you for the help!

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [August 7, 2020, 12:25am UTC](https://forum.inductiveautomation.com/t/scripting-question-with-custom-property/37484/2 "2020-08-07T00:25:21Z")

</div>

It looks like you’re mixing [Ignition’s Jython scripting](https://docs.inductiveautomation.com/display/DOC80/Scripting) with [Ignition’s expression language](https://docs.inductiveautomation.com/display/DOC80/Expression+Overview+and+Syntax) in an expression binding that can only use the expression language.

The equivalent expression would be something like:

```auto
isAlarmActive(tag('[default]Motor_ID/*/' + {Root Container.Motor_Reference::Belt_ID}))

```

However, there are some other issues.

1. Don’t use the `tag` expression function here. Instead, use an [indirect tag binding](https://docs.inductiveautomation.com/display/DOC80/Indirect+Tag+Bindings+in+Vision) to include your Belt\_ID in the tag path. See #3 below.
2. I’m not sure what your intent is with the asterisk in the path, but I expect that won’t work here.
3. `isAlarmActive` seems to always return false and bad quality when (tested it in Ignition 8.0.15). I may be missing something, but you could probably just bind to your tag path + `/Alarms.HasActive` in your indirect tag binding directly on the visible property, something like:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/b/1b947f5a020c0befed333390887874696f72106f.png)

---

<div class="post-metadata">

**Author:** ![trishadx](https://avatars.discourse-cdn.com/v4/letter/t/eb9ed0/32.png) [@trishadx](https://forum.inductiveautomation.com/u/trishadx)\
**Post date:** [August 7, 2020, 11:33am UTC](https://forum.inductiveautomation.com/t/scripting-question-with-custom-property/37484/3 "2020-08-07T11:33:01Z")

</div>

Oh i see. The asterisks was using a wildcard as my tags list has 3 tiers to it. and the final level of that would be a UDT tag, which has multiple alarms on it so i was using the \* as a way to say if any had an in-alarm state.  
I was suggested doing it this way for the script editor, so i though id use it this way for the expression

Thank you @witman, i used the indirect binding and its definitely on its way. However, what do you suggest…as below, im only seeing if the em\_stop alarm is active, when in fact, this UDT has more than 1 alarms on it. what would the expression be if i wanteed it to show all the alarms on this 1 UDT?

thank you for the help!

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

---

<div class="post-metadata">

**Author:** ![trishadx](https://avatars.discourse-cdn.com/v4/letter/t/eb9ed0/32.png) [@trishadx](https://forum.inductiveautomation.com/u/trishadx)\
**Post date:** [August 7, 2020, 2:07pm UTC](https://forum.inductiveautomation.com/t/scripting-question-with-custom-property/37484/4 "2020-08-07T14:07:22Z")

</div>

Just for future reference… After many trial and error I was able to get the animation I wanted with the visibility of a component binded to a UDT tag’s is alarm active… with the expression

`isAlarmActive({Root Container.Motor_Reference::Meta.TagPath}+"/*")`

Thank you!
