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?
ID = {Root Container.Motor_Reference::Belt_ID}
tag = '[default]Motor_ID/*/%s' % (ID)
if (isAlarmActive(tag) = 1,visible=1)
Don’t use the tag expression function here. Instead, use an indirect tag binding to include your Belt_ID in the tag path. See #3 below.
I’m not sure what your intent is with the asterisk in the path, but I expect that won’t work here.
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:
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?
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