Hi all!
I am currently working on a trending PowerChart for my app. I have about 76 pens manually entered into the chart with bindings to buttons that help filter the pens by room number.
I did quite a bit of work on the chart yesterday and it was working great. Today, I've come to check that everything was still working well. When I toggle the active mode in designer, the buttons work perfectly for filtering of the chart.
However, when I launch a Perspective session from Tools, the filtering doesn't work at all! What could be causing this discrepancy? I really hope it doesn't result in me having to redo the pens or buttons all over again. Any ideas?
The only log error I'm getting is about not being able to pull data for one out of 76 pens, which is a tag that will be getting fixed soon but I don't think that would be a reason that filtering isn't working? This is a remake of a Vision app, where the trending has the same amount of pens with no issue.
Here's the code on one of the buttons for filtering of one room, as well as a pen that is associated with that room.
Button (onClick Event script). The other buttons follow this same format, just swapped with the relevant custom property:
def runAction(self, event):
self.custom.Clicked = 1
self.getSibling("R125").custom.Clicked = 0
self.getSibling("R126").custom.Clicked = 0
self.getSibling("R132").custom.Clicked = 0
self.getSibling("um5").custom.Clicked = 0
self.getSibling("um3").custom.Clicked = 0
self.getSibling("ShowAll").custom.Clicked = 0
Pen associated with the button. This expression binding is bound to the "visible" property of the pen. "Clicked_" is property bound to the custom properties referenced above:
if({this.custom.Clicked124} = 1,true, //filter by room
if({this.custom.Clicked5} = 1, true, //filter by concentration
if({../ShowAll.custom.Clicked}, true, false //show all pens
)
)
)
I'm not sure why you would see a difference between the designer preview and a true perspective session. Sometimes it can happen because of subtle type differences caused by object serialization. But I would expect errors in the logs that complain about that.
Regarding the method if filtering, it might be more maintainable to implement it entirely through scripting rather than 76 bindings... Do the tagpaths or pen names include information about which room or concentration they belong to? Perhaps something along the lines of:
for pen in path.To.Powerchart.props.pens:
pen['visible'] = "concentration" in pen['name']
in the button script would be easier and faster to write or change?
This script is a great idea, I will try to implement and see if it works. This is my first Ignition app I'm building so I'm not surprised I'm doing things in roundabout ways when there's something similar. I actually had no idea I could target that property in pens like that.
I still am not quite sure why I'm having a difference in views but this, at least, is teaching me something new and very useful. Thank you!
As an update: I figured it out after a very long call with IA support. My issue was in the main view of my session.
It seems that I have too many embedded views (working as UDTs) in my main view and it was eating up computer memory, causing the buttons in any of my popups to not work (including native buttons such as acknowledging in alarm tables).
I do have a further question, what is the solution to this? I have about 33 embedded views on this main page. Does this mean I need to manually do every instance that was previously an embedded view with parameters fed in?
I'm quite frustrated about it and am desperately hoping that is not the answer. Any help??
Maybe just add RAM to your server?