LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bundle by Name output in a Sub-VI

Hi all,

 

So I am trying to take multiple output strings and numerals from a sub-vi and pass them out of the sub-vi using the terminals and Bundle by name (that is instead of wiring up 10+ outputs to one sub-vi).

 

I have 10+ string Indicators, and 10+ Numerial Indicators. What I would like to do is create two clusters/bundles that I can use as two outputs for wiring up my sub-vi terminals for the purpose of passing that data out of the sub-vi.

 

So How can I use the indicators (w/ names) as my inputs to a bundle with names? I know that when I use the Sub-VI in another labview program, I am able to bundle with names the output terminals, but I would like to simplify everything to just two bundles.

 

 

Any help would be greatly appreciated!

Download All
0 Kudos
Message 1 of 10
(4,430 Views)

It looks to me like you really have an array of sub-strings, or alternatively an array of numbers.  It looks like each string you convert to a number -- instead of outputting both the string and its associated number, just output one (you can always convert to the other if you need it).  Why not output a single array of all the values, instead of 10 separate values?  It looks like the parsing of the string is similarly repetitive -- if you are doing the same thing over and over, that also suggests a (While) Loop.

 

BS

0 Kudos
Message 2 of 10
(4,423 Views)

@Bob_Schor wrote:

It looks like the parsing of the string is similarly repetitive -- if you are doing the same thing over and over, that also suggests a (While) Loop.


In this case, a While loop with a shift register to hold the string and then autoindex the number.  In the end, you have an array of numbers!

GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 10
(4,395 Views)

If i did that how would I still have the Label with each value. For example (see picture), I am using this sub-vi to remove most of the code needed in the main VI so that it just comes down to how you want to display the data. So How would I both create the bundle (like seen in the picture) and have it just be a simple bundle with name output terminal on the sub-vi?

 

 

Simply; Is there a way to bundle with name the indicators (w/ their labels?) and if so how? or create label strings, create an array of those numbers, and bundle them together so I can Unbundle With Names?

 

A

0 Kudos
Message 4 of 10
(4,377 Views)

Hi abirkel,

 

you can change the label of all indicators in your cluster (on the subVI frontpanel), so they will show the name as you like to…

 

Other options:

- use an array of cluster of (name-string, value-number)

- use key-value-pairs as offered by variant attributes

- use any CVT implementation, there are several offered on NI website…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 10
(4,365 Views)

I know that you can change the Label names.

 

What I am trying to get at is this:

 

When you wire up the terminals to the indicators, the output from the sub-vi is (Indicator Name) Associated with (Value output of Indicator). In your VI you can use that instantly to Bundle which allows you to use UnBundle with names. This is an important issue for me because I would like to select which strings/numerals I want to read-out of the bundle by their name (the label I gave to the Indicators in my sub-vi).

 

 

All I want to know is if there is a way to have the Bundle With names, of the Indicators in the sub-vi, Then be able to Wire that bundle with a terminal Output of the VI. So in the End I would have 1 Terminal output, instead of the 10+ terminals for each individual output string (Indicators).

 

I understand giving advice on optimizing my code, I know my current code is not optimizied... I am currenlty JUST trying to solve the "Using too many terminals outputs".

 

TL;DR -

 

I want to have 1 Terminal output from my VI that is an array/bundle/set of data, How do I go about doing that so that when I take that data out of the VI, I can actually have Labels on each data point. So for my code; The ability to know the difference between Cell 1 and Cell 2. 

0 Kudos
Message 6 of 10
(4,352 Views)

If you insist on using a cluster, then make a cluster with the labels that you want.  MAKE IT A TYPE DEF CONTROL.  Make a constant of that cluster type and wire it into the type input for a Bundle By Name.  When you go to unbundle, use the Unbundle By Name.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 10
(4,340 Views)

Hi, it has been many years, but no one above provided simple enough solution to what the starter trying to get.

 

It's simple like this: only control and constant will carry name (label) to bundle, so if want indicators to be bundled with name, use either as a pseudo constant of the bundle to be replaced.

 

Of course you may remove the bundle without name one, that is just for comparison.

 

princelog_0-1696900825362.pngprincelog_1-1696900843343.png

 

 

0 Kudos
Message 8 of 10
(915 Views)

Why doesn't the Output Cluster resemble the TypeDef?  Why is "Period [us]" on the TypeDef showing up as "Td [us] 4"?

 

Bob Schor

0 Kudos
Message 9 of 10
(909 Views)

Oh, my bad, because they are captured at different time, it is unified now. Thank for noticing this.

0 Kudos
Message 10 of 10
(905 Views)