# How to set indicator value on Vision momentary Button Component with isAlarmActiveFiltered()

**URL:** <https://forum.inductiveautomation.com/t/how-to-set-indicator-value-on-vision-momentary-button-component-with-isalarmactivefiltered/80626>\
**Category:** General Discussion\
**Created:** [October 18, 2023, 12:12am UTC](https://forum.inductiveautomation.com/t/how-to-set-indicator-value-on-vision-momentary-button-component-with-isalarmactivefiltered/80626 "2023-10-18T00:12:33Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anthony\_Solimine](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@Anthony\_Solimine](https://forum.inductiveautomation.com/u/Anthony_Solimine)\
**Post date:** [October 18, 2023, 12:12am UTC](https://forum.inductiveautomation.com/t/how-to-set-indicator-value-on-vision-momentary-button-component-with-isalarmactivefiltered/80626/1 "2023-10-18T00:12:34Z")

</div>

Hello ,

I am currently developing a gateway where I will have 5 zones and on a navigation bar I wanted to have 5 buttons that use indicator value bindings to drive a fault graphic. I found the isAlarmActiveFiltered expression and after playing with it I could get active alarms with specific display path key words to set the indicator value to 1, but if there is no alarm the component is broken like a "BadNotFound" quality tag. Since i ran into a wall there, I am curious if there is a way to bind the scripting function for filtering the alarm status table in a Custom Method script that will filter on associated data "Group" that can set the indicator value to 1 if there are any "associated data" filtered alarms?

---

<div class="post-metadata">

**Author:** ![kyler.kamyszek](https://avatars.discourse-cdn.com/v4/letter/k/a4c791/32.png) [@kyler.kamyszek](https://forum.inductiveautomation.com/u/kyler.kamyszek)\
**Post date:** [October 18, 2023, 1:53pm UTC](https://forum.inductiveautomation.com/t/how-to-set-indicator-value-on-vision-momentary-button-component-with-isalarmactivefiltered/80626/2 "2023-10-18T13:53:31Z")

</div>

IsAlarmActiveFilter returns True/False, so it's probably an issue with using a Boolean as an integer.

Add an if statement in your expression and return 1 if true and 0 if false.

---

<div class="post-metadata">

**Author:** ![Anthony\_Solimine](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@Anthony\_Solimine](https://forum.inductiveautomation.com/u/Anthony_Solimine)\
**Post date:** [October 18, 2023, 4:51pm UTC](https://forum.inductiveautomation.com/t/how-to-set-indicator-value-on-vision-momentary-button-component-with-isalarmactivefiltered/80626/3 "2023-10-18T16:51:06Z")

</div>

Ok that makes a lot of sense, being that the binding would be broken unless there was an alarm present.

Forgive me , is there a certain way to implement the if statement in the expression. I am entry level at scripting and cant seam to see this in a way that makes sense to run trial and error in the expression binding window.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [October 18, 2023, 5:12pm UTC](https://forum.inductiveautomation.com/t/how-to-set-indicator-value-on-vision-momentary-button-component-with-isalarmactivefiltered/80626/4 "2023-10-18T17:12:45Z")

</div>

Change your expression to something like:

```auto
if(isAlarmActiveFiltered(your, settings, here),
   1,
   0
  )

```

---

<div class="post-metadata">

**Author:** ![Anthony\_Solimine](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@Anthony\_Solimine](https://forum.inductiveautomation.com/u/Anthony_Solimine)\
**Post date:** [October 18, 2023, 5:13pm UTC](https://forum.inductiveautomation.com/t/how-to-set-indicator-value-on-vision-momentary-button-component-with-isalarmactivefiltered/80626/5 "2023-10-18T17:13:57Z")

</div>

thank you I appreciate it. I was no where near close to this.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [October 18, 2023, 5:14pm UTC](https://forum.inductiveautomation.com/t/how-to-set-indicator-value-on-vision-momentary-button-component-with-isalarmactivefiltered/80626/6 "2023-10-18T17:14:43Z")

</div>

Some reference material:

[https://docs.inductiveautomation.com/display/DOC81/Expression+Functions](https://docs.inductiveautomation.com/display/DOC81/Expression+Functions)

---

<div class="post-metadata">

**Author:** ![Anthony\_Solimine](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@Anthony\_Solimine](https://forum.inductiveautomation.com/u/Anthony_Solimine)\
**Post date:** [October 18, 2023, 5:27pm UTC](https://forum.inductiveautomation.com/t/how-to-set-indicator-value-on-vision-momentary-button-component-with-isalarmactivefiltered/80626/7 "2023-10-18T17:27:18Z")

</div>

**Code Snippet**

` ` `if` `(` `1` `, ` `"Yes"` `, ` `"No"` `) ` `//Would return "Yes".`

after reading the DOCs again, I still dont understand where the true false evaluation comes in.

if there more I to add besides the settings.

this is what i am trying to run in the expression:  
if(isAlarmActiveFiltered("_", "_", "South Cold Storage", 4, 4, 0, 1, 0),  
1,  
0  
)

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [October 18, 2023, 5:29pm UTC](https://forum.inductiveautomation.com/t/how-to-set-indicator-value-on-vision-momentary-button-component-with-isalarmactivefiltered/80626/8 "2023-10-18T17:29:12Z")

</div>

**if(condition, trueReturn, falseReturn)**

The expression in the condition portion of the function needs to evaluate to true/false.

What is the result of this? (maybe make a separate expression to monitor it)

`isAlarmActiveFiltered("", "", "South Cold Storage", 4, 4, 0, 1, 0)`

---

<div class="post-metadata">

**Author:** ![Anthony\_Solimine](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@Anthony\_Solimine](https://forum.inductiveautomation.com/u/Anthony_Solimine)\
**Post date:** [October 18, 2023, 5:35pm UTC](https://forum.inductiveautomation.com/t/how-to-set-indicator-value-on-vision-momentary-button-component-with-isalarmactivefiltered/80626/9 "2023-10-18T17:35:23Z")

</div>

the result is the Button component gets a 1 pushed to the indicator value property binding initiating a style change.

It worked to turn on the button but two things happened:  
A. when there were no alarms present there was a BadNotFound quality assessment on the binding  
B: when the true came back and pushed a 1 to the indicator value it never cleared back to 0 turning the component back to its 0 value for the Style Customizer settings.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [October 18, 2023, 5:37pm UTC](https://forum.inductiveautomation.com/t/how-to-set-indicator-value-on-vision-momentary-button-component-with-isalarmactivefiltered/80626/10 "2023-10-18T17:37:08Z")

</div>

Just noticed that perhaps it should be (note the asterisks in the first two arguments).

```auto
isAlarmActiveFiltered("*", "*", "South Cold Storage", 4, 4, 0, 1, 0)

```

---

<div class="post-metadata">

**Author:** ![Anthony\_Solimine](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@Anthony\_Solimine](https://forum.inductiveautomation.com/u/Anthony_Solimine)\
**Post date:** [October 18, 2023, 5:48pm UTC](https://forum.inductiveautomation.com/t/how-to-set-indicator-value-on-vision-momentary-button-component-with-isalarmactivefiltered/80626/11 "2023-10-18T17:48:44Z")

</div>

For some reason they didnt transcend when i copied, but the asterisks are in place for the first two settings and still not the correct evaluation.

I think the idea that this is returning a boolean in the place where ignition is looking for a 1/0 is really good starting point, but it seams to be advanced expression to convert it. I think if i was to make this visible and not a style change maybe it would be more straight across because visible looks for boolean response automatically?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [October 19, 2023, 2:06am UTC](https://forum.inductiveautomation.com/t/how-to-set-indicator-value-on-vision-momentary-button-component-with-isalarmactivefiltered/80626/12 "2023-10-19T02:06:41Z")

</div>

> [@Anthony\_Solimine](#):
>
> this is returning a boolean in the place where ignition is looking for a 1/0

This isn't correct. For Boolean purposes, `True, False` and `1, 0` can be used interchangeably without issue, but my preference is `True, False`.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 19, 2023, 2:31am UTC](https://forum.inductiveautomation.com/t/how-to-set-indicator-value-on-vision-momentary-button-component-with-isalarmactivefiltered/80626/13 "2023-10-19T02:31:54Z")

</div>

> [@JordanCClark](#):
>
> ```python
> if(isAlarmActiveFiltered(your, settings, here),
>    
> 
> ```

You can also use

```python
1*isAlarmActiveFiltered(your, settings, here)

```

---

<div class="post-metadata">

**Author:** ![Anthony\_Solimine](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@Anthony\_Solimine](https://forum.inductiveautomation.com/u/Anthony_Solimine)\
**Post date:** [October 19, 2023, 2:08pm UTC](https://forum.inductiveautomation.com/t/how-to-set-indicator-value-on-vision-momentary-button-component-with-isalarmactivefiltered/80626/14 "2023-10-19T14:08:13Z")

</div>

thank you for the correction.

---

<div class="post-metadata">

**Author:** ![Anthony\_Solimine](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@Anthony\_Solimine](https://forum.inductiveautomation.com/u/Anthony_Solimine)\
**Post date:** [October 19, 2023, 2:19pm UTC](https://forum.inductiveautomation.com/t/how-to-set-indicator-value-on-vision-momentary-button-component-with-isalarmactivefiltered/80626/15 "2023-10-19T14:19:57Z")

</div>

After creating some test expression tags, I have found that if the state of the alarm is active in ignition when I set the expression up and press ok to create the tag it causes an evaluation that sets the value of the tag in that moment.

both parts of the expression work individually,

if({[.]AStatus}="true", 1, 0)

isAlarmActiveFiltered("_", "_", "Machine Area", 0, 4, 0, 1, 0)

But it doesn't constantly evaluate for the alarm that i can tell testing in the tag browser.

Does this sound right ?

I know very little about how expression tags execute.

---

<div class="post-metadata">

**Author:** ![Anthony\_Solimine](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@Anthony\_Solimine](https://forum.inductiveautomation.com/u/Anthony_Solimine)\
**Post date:** [October 19, 2023, 2:31pm UTC](https://forum.inductiveautomation.com/t/how-to-set-indicator-value-on-vision-momentary-button-component-with-isalarmactivefiltered/80626/16 "2023-10-19T14:31:35Z")

</div>

i just figured out you can set a poll rate to evaluate constantly.

In my tag I had first set "Event Driven"  
Then i realized i can set a fixed rate.

---

<div class="post-metadata">

**Author:** ![Anthony\_Solimine](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@Anthony\_Solimine](https://forum.inductiveautomation.com/u/Anthony_Solimine)\
**Post date:** [October 19, 2023, 2:46pm UTC](https://forum.inductiveautomation.com/t/how-to-set-indicator-value-on-vision-momentary-button-component-with-isalarmactivefiltered/80626/17 "2023-10-19T14:46:09Z")

</div>

Thanks for all the input guys
