From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting Challenge: Determine of a terminal is a Sequence Local

Solved!
Go to solution

While writing a plugin that deals with cluster terminals, I found that I needed to distinguish among terminals in various contexts: on control and indicator terminals, tunnels, and yes even sequence locals in stacked sequence structures--for completeness only.

 

In most cases I have been able to determine from a terminal's ownership hierarchy (accessed from the "Owner" property") what flavor of terminal I'm dealing with. But I found that this does not work for terminals inside of flat or stacked sequence structures. Any terminal inside a Sequence structure has an ownership hierarchy that looks like

 

[some object]:Diagram:Sequence:TopLevelDiagram

 

OR

 

[some object]:Diagram:FlatSequeceFrame:FlatSequence:TopLevelDiagram

 

Obviously there may be more levels to this for nested structures, but there's no hint of the sequence local here.

 

Capture.PNG

 

I have a workaround for my plugin, because I needed to make this distinction only for placement in a contextual menu, and I could use a particular menu items of a sequence local to determine the difference, but it seems like there should be another way, and relying on the menu seems too fragile in the face of version changes.

_____________
Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 1 of 5
(1,836 Views)

I guess that's just one more reason to add to my list of reasons why stacked sequence structures are evil.  😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 2 of 5
(1,824 Views)
Solution
Accepted by topic author littlesphaeroid

If the owner structure is a sequence, get it's list of it's locals (Sequence Locals[] property). From each sequence local, get a list of terminals. Keep that list.

 

For each terminal, see if it's in the list of sequence terminals. If there is a match (a Search 1D Array should work), the terminal is a sequence local...

 

It depends a bit on the context. Are you traversing controls, wires, structures? Perhaps you can post a VI that demonstrates the problem, so we can work on it?

Message 3 of 5
(1,787 Views)

Your solution makes sense, and I'll try it out. I am acting on a right-clicked sequence local (or any other terminal). By using the owner reference, I can get the sequence locals of the sequence structure and determine of the clicked terminal is in that list. Great!

_____________
Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 4 of 5
(1,762 Views)

I have attached sample code that shows how to determine if a terminal reference is a sequence local.

_____________
Creator of the BundleMagic plugin for LabVIEW!
Message 5 of 5
(1,742 Views)