07-27-2015 03:19 PM
What you are suggesting would make the diagram dirtier, not cleaner. Use linked input tunnels and a cleanly layed out diagram and these wires won't cause any congestion.
Especially if the code is already all wired up, it seems silly to mess it up with some misguided idea of cleanliness. 😉
07-28-2015 01:06 AM
While both the local and the global would work, and in the case of a single refnum they won't make a noticable difference, I would advise not doing that either, mainly from a safety and cleanliness point of view. As far as readibility goes, I agree that locals can make code easier to read and write. Rather than having unneeded wires all over, you only have the data where you need it and it's easy to find all the callers with a right click, so a local wins there. It does make it easier, however, to create race conditions by interacting with the same resource from more than one place in parallel and once your code has many locals or globals, it can sometimes be hard to figure out the relationship between the different parts of the code.
Some additional options:
07-28-2015 06:51 AM
sjandrew wrote:
Edit - I only have one VI, but the comment above suggests that global variables would work in this situation: any reason to use a global over a local?
A global does not dirty up your front panel and it is a little faster. However, since you are dealing with just a single VI, I would just stick with the wires as they will absolutely be the fastest and avoids race conditions. But if you really insist on getting away from using the wires, then the Action Engine is the way I would go.