LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I pass treeview items from a SubVI to my Main VI?

Solved!
Go to solution

As the title says. Probably a simple concept but I just can't get it.

0 Kudos
Message 1 of 12
(4,326 Views)

I'm assuming that the VI you attached was the SubVI.  If so, the Tree is wired to the upper right-hand output terminal.  If you put this VI down on a diagram and attach a wire to it, you'll get the tree.  I've attached a Snippet showing this -- the block called Tree Data is your VI, with an icon I made so you'd know what it was.  I just wired an indicator to its output terminal, and as you can see, it's a tree.

 

Tree Question.png

0 Kudos
Message 2 of 12
(4,323 Views)

Bob,

 

You are correct that this does make it a tree. My issue is if I place a probe on the left side, I get a empty string returned. I would have thought the the data in the tree would have passed over. If you take a look at my Main.vi, you'll see in the ShipmentID event case where I am trying to bring the data over into the Main.vi tree from the SubVI.

 

 - Eric

0 Kudos
Message 3 of 12
(4,316 Views)

Sorry, but when I open Main, I get lots of errors because all the other sub-VIs are missing.  If you are running a fairly recent version of LabVIEW (I think it was present in LabVIEW 2009, certainly in 2010 and 2011), you can create a "snippet", which is basically a .png image of (part of) your block diagram that you can include on posts you make here.  This way, you can show everyone what the code looks like, where the wires are, and can then ask questions about why it doesn't work.  Simply "drag a box" around the code you want to show, go to the Edit menu, and select "Create VI Snippet from Selection".  Save the .png, then paste it in here in your message (use the 11th icon, the Picture, in the tool bar when you compose the message -- be sure your cursor is where you want the picture to appear, like on a line by itself ...)

 

Bob Schor

0 Kudos
Message 4 of 12
(4,312 Views)

Hi Bob,

 

Here's the snippet. I'll add the other VIs.

 

TreeViewTrouble.png

Download All
0 Kudos
Message 5 of 12
(4,309 Views)

Before creating your Snippet, be sure it shows what you want to ask about (e.g. the Shipment ID value change case).

 

Still couldn't load without errors, as you are using some Database tools that I don't have.  However, if the question is "Why is my tree empty?", the answer may be that ShipmentTreeData either (a) doesn't work or (b) doesn't have "good data".  The easiest way to test this is to feed it "known" data and then watch what it does (maybe literally "watch" by turning on the little light bulb on the Block Diagram, but it may be easier, certainly faster, to put probes at key places and let it run).

0 Kudos
Message 6 of 12
(4,305 Views)

The built-in LabVIEW snippet tool stinks.  It screws up property nodes and the event structure.  The Code Capture Tool is much better at creating snippets.

 

I think your problem is that with your event structure, you have several output tunnels where the data is not defined for every case.  The tunnels are set for Use Default if Unwired, which means an empty tree when those cases run.  Since the case that has a boolean stop button does not have anything defined for that tunnel, I'm betting that is causing your problem.

0 Kudos
Message 7 of 12
(4,301 Views)

Take a look at this Tree toolkit for some great info on Trees. I have added a couple of fucntions so that I can save and recall trees from a text file but other than that it's a great toolkit.

0 Kudos
Message 8 of 12
(4,281 Views)

I'm wondering if I need something wired to the Tree in my Sub VI which feeds the other Tree in my Main VI.

 

TreeViewTrouble2.png

0 Kudos
Message 9 of 12
(4,255 Views)

Unlike 2d array controls where you wire up directly the indicator or control for trees you need to pass a reference. Please see the toolkit I commented on above.

 

Norm

0 Kudos
Message 10 of 12
(4,250 Views)