04-18-2025 12:32 PM
I often write VIs that modify controls. For example, I may have a complex set of graph updates: update graph value, change color of the trace(s) based on pass/fail status, name the traces the legend, etc. What I tend to do is have VI input for the control reference, and on the BD, for debugging purposes, I will select the VI's local graph reference when the VI is running top level:
This morning it occurred to me there may be better ways. For example, if I wanted to have this VI open while running the main VI, the local graph wouldn't be updated/styled. Maybe not a problem, I'm probably overthinking this, but checking instead if the reference's parent's FP is open might be even better, and updating either or both of the referenced controls could be useful.
Anyway, wondering how other people handle this sort of situation.
04-18-2025 01:19 PM
You could check the Graph Ref and see if it is a valid reference. If not, assume you are running for debugging and use the local graph reference.
Top level usually works, except for asynchronously called VI's.
04-18-2025 02:34 PM
I think checking for a valid reference is better in the sense that it's less costly than checking if the file is running top level! Thanks for that idea!