LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help needed in building a tree without duplicating the nodes

Iam trying to construct a tree, ID name as the parent node and channel name & channel values as its corresponding child nodes.


I had constructed the tree, but the problem i have is with interfacing that with in my  main program. In the main program say suppose I have 5 Id's, each Id has some X number of channel's. And each channel has a value.

 

Each Id is indexed and passed to the for loop. And since this for loop is inside the while loop each ID will be executed for every 5 iterations.

Id, channel names will be constant each time it gets executed, but the channel value's will be updated during run time.

 

If I directly feed the Id, channel names and values, replacing the constants in the vi, the tree is duplicating the messages, each time a ID is received inside the for loop, it is creating a new parent and child nodes.

 

Please help me in fixing this issue, and constructing the tree, where the ID and channel names are not not duplicated.For better understanding Iam attaching a snapshot shot, which tells at what point the ID, channel name array and value is received.

Download All
0 Kudos
Message 1 of 4
(2,645 Views)

pks:

 

I'm not 100% familiar with your application, so take all of this with a proverbial grain of salt. Robot wink

 

It looks like your Read (at the top left corner of your screen shot) is producing an array of clusters. Each cluster contains a parent ID ("arbitrationID") and a child data array ("Data"). If I understand you correctly, every "arbitrationID" item is the same, and you don't want it duplicated every time the main for loop iterates?

 

If that's the case, you might be able to take one "arbitrationID" outside the for loop and only unbundle the data inside. This way, it will take one "arbitrationID" and re-use it from the tunnel on the for loop border.

ID_non_duplicate.png

 

I'm not 100% sure if that's what you're looking for. If not, would you be willing to post a "before" and "after" screen shot of the input and output data arrays/clusters? It might help us figure out how you want it parsed and organized if you post those and point out what's wrong with the output you have right now.

Caleb Harris

National Instruments | http://www.ni.com/support
0 Kudos
Message 2 of 4
(2,619 Views)

Caleb Harris, the arbitration ID is not the same each time. Cluster has several different id's, this can be seen in the attached screen shot. Attached sreen shot shows the cluster information,  a sample ID unbundled from the array and the list of channels in that Arbitration ID. I got an idea how to construct the tree but for that,

 

1)Need to store all this arbitartion Id's,channel's , and values in 3- different arrays (Channel array and the values array must have the same size).

2)Channel array must be in synchronus with the Value array say like the first index value of the value_array  should represent the value of the first element of the channel    

   array, similarly the second index value of the value_array  should represent the value of the second element of the channel array and so on.

3) When ever the channel value gets updated, that particular element of the value array should be updated.

 

If I can do this 3- steps I think I can succesfully build a tree. Can you please take a look at the snapshot and help me out in doing this.

0 Kudos
Message 3 of 4
(2,591 Views)

Here's a modification that should allow you to append data under each channel in the "value" column. Hope that helps!

 

channel_info_append.png

channel_info_append_bd.png

Caleb Harris

National Instruments | http://www.ni.com/support
0 Kudos
Message 4 of 4
(2,562 Views)