LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to 'automatically' wire a bunch of stuff to 'build-array' inputs?

Solved!
Go to solution

 

Hey Labview peeps! Here's one for ya. I have a bazillion things I need to wire to build array terminals. This makes it easy to send the array to CSV files later in the code. So the first step is to gather all the property nodes of the controls and indicators that I want to build, and wire them all up to an array. 

 

My solution was to split it up into 3 small arrays and join them together to one final grand-daddy array. "ONE ARRAY TO HOLD THEM ALL" if you will. 

 

So this is obviously painstaking. As I tediously try to wire each little dot to the other little dot, I am constantly asking myself, "how do the pros tackle stuff like this?"

 

I know you've been looking for someone to post something stupid, so blast away! Tell me how YOU would have done it better! I'll get the popcorn and swallow my pride.

 

build it big.JPG

0 Kudos
Message 1 of 15
(3,743 Views)

You seem to really love property nodes (why would you write to the value property of "Label Array" instead of the terminal?!) and I get the feeling that you are approaching the problem you are trying to solve the wrong way.

 

Labels are defined at compile time, so you should know them already. Why read them out? What are you doing with the "label Array" later? It would be orders of magnitude faster to just past these labels into a string array constant than create all these property nodes first. (Also note that your "insert into array" should be "built array (concatenate mode)" nodes)

 

Maybe it would really help if you could explain in more general terms what you want to do, not how you want to do it.

Message 2 of 15
(3,737 Views)

@altenbach wrote:

You seem to really love property nodes (why would you write to the value property of "Label Array" instead of the terminal?!) and I get the feeling that you are approaching the problem you are trying to solve the wrong way.

 

Labels are defined at compile time, so you should know them already. Why read them out? What are you doing with the "label Array" later? It would be orders of magnitude faster to just past these labels into a string array constant than create all these property nodes first. (Also note that your "insert into array" should be "built array (concatenate mode)" nodes)

 

Maybe it would really help of you could explain in more general terms what you want to do, not how you want to do it.


Big guess, but I'm guessing these will become headers in some report or something of that nature, and the headers would then change if a change was made to the labels of the controls.

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 3 of 15
(3,727 Views)
Solution
Accepted by Dr_Daryl

Altenbach raises a lot of valid points that you should really pay attention to, but to actually answer the question there is a "automatic" way to wire things, assuming your LabVIEW version is new enough.  I know 2018 is new enough, I think this was added somewhere in the 2012-2017 range.

 

1. Drop a bunch of stuff with outputs in a column on the left

2. Drop a build array node on the right side and make it really big by expanding it down

3. Select all of them with the mouse

4. Press control-space to open the quick drop window (you may have to wait a few seconds for it to process if you haven't opened it before)

5. Press control-W (or control-shift-W if you want it to automatically do a cleanup of the diagram afterwards).

Kyle97330_0-1644426823088.png

It also works if you have a bunch of nodes in a row, too:

 

Kyle97330_0-1644426944134.png

 

Message 4 of 15
(3,714 Views)

@billko wrote:
Big guess, but I'm guessing these will become headers in some report or something of that nature, and the headers would then change if a change was made to the labels of the controls.

Then I would probably iterate over an array of references. Still seems overly complicated. 😄

No matter what, I would probably also use the legend instead of the label.

 

 

0 Kudos
Message 5 of 15
(3,713 Views)

@Kyle97330 wrote:

1. Drop a bunch of stuff with outputs in a column on the left


Here we have two outputs (string, error) per node. I wonder what it'll do. 😮

0 Kudos
Message 6 of 15
(3,711 Views)

I would rather place all these related controls in a pane, get the list of references programmatically and parse their Label.

 

If all these controls/indicators can't be placed in a pane, you can have a naming convention like "<Label>.Include" so that you can filter the labels that you're interested in and not just everything.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 7 of 15
(3,708 Views)

Hello altenbach! I will attempt to answer your questions:

 

1. I DO love property nodes! Why you ask? Well here are my reasons:

 

a. I can't use local variables. I have tried. My application has to access OPC controls that use the old, antiquated architecture, and that necessitates datasocket binding, and using those values in several places throughout the code. These OPC DA sockets do not support local variables according to a known bug report I read a few years ago, and so I had to start using property nodes to pass information around. The customer is now used to them, so if I change up how I'm sharing data in the application it will confuse them. 

b. I have developed an 'event handling state machine' for my application. The customer is always changing their mind on what to call the inputs and outputs, so I decided to group them all into a handy collection on the left side of the block diagram (see photo below). This way I can flip through the pages and find all the terminals in one handy place (except for the switch booleans that have to be present in the event handler). That way, they can rename stuff without digging through the code and the terminal name will propagate to all the property nodes!

 

2. Why read out labels?

 

Well, my application generates CSV spreadsheets that have all the labels listed down the left column, then each batch operation populates other columns with the results off to the right side of the labels. What I did was make one array for labels, then copied that to another frame and changed 'Label.Text' to 'Value', and created an array of results. Now, I can take those two arrays and combine them in several methods (see photo below). I can also read back the results from the file and assign them back to the indicators so the GUI will have the same data as was saved out to the file. I'm SURE there's a better way here. 

 

3. Why not create string array for the labels?

 

All those little wires I painstakingly wired up can be copied and pasted to another frame, where the labels are replaced by values, or other properties. This was my way of having to do the wiring one time, then I have the structure in place and I can just change the inputs as needed. Everything will be in the same order because the controls/indicators are all linked in the same order.

 

4. Use build array concatenate mode:

 

WOW. I never noticed the option to concatenate (I never right clicked on the build array node before). This makes me wonder what other options are hidden away like easter eggs in other controls? And why wouldn't Labview make these options inputs to the node? It's like a little secret treasure trove of information that only the super elite Labview gurus know about! Ok so I'll start using that option- is it faster than 'Insert into Array'?

 

Thank you!

 

large block.JPGwrite out.JPG

0 Kudos
Message 8 of 15
(3,701 Views)

You are exactly correct! I just posted a detailed description of how they're used. 

0 Kudos
Message 9 of 15
(3,700 Views)

WHAT IS THIS MAGIC?!? The Quick Drop Window has the ability to wire stuff? Why don't they call it a "Quick Method" or "Shortcut Window"? I assumed the Quick Drop was just for controls and operators. I will have to find some training on all that thing does now!!

 

Thank you for answering my question and taking the time to illustrate. I hope this helps other young Padawans who have never used the Force in Labview yet!!

0 Kudos
Message 10 of 15
(3,695 Views)