06-01-2012 03:51 PM - edited 06-01-2012 03:54 PM
Hi Nick,
Getting closer each time!
I have came close to getting it, but some of my nodes are being placed in spots that they shouldn't be, i.e. wrong product line, wrong plant, wrong shipment #, etc...I think it's finding a match and placing it under the wrong parent with the way I have it wired now. I'm not sure how to to compare what is in the tree to my array without using the All Tags Property Node. I assume that this is what it's used for. Should I be using something else?
I've enclosed my VI for you to look at.
I apologize for my ingnorance on some of my questions. This is my first stab at any kind of treeview item and a little hand-holding may be necessary.
06-04-2012 09:44 AM
Eric,
No problem using the All Tags Property node. I think you will need to design your code so that you step through each element of each row in the data array. Then check to see if the proper tag exists. If no tag exists, then you need to add a child element under the proper parent tag.
I would do this by autoindexing the array in a for loop like you have done. Then check to see if the element in Column 1 (Country Code) already has a tag. If it does, move to element in Column 2 etc. If no tags exist, add a tag for Country, Product Line, Plant etc.
It seems like you are close, keep at it and you will get there!
-Nick-
06-07-2012 10:38 AM
Hi Nick,
As you can see, I had to first put a node in the tree before all of the For Loops ran. If I didn't, the third For Loop would never run because nothing would be in the Tree.All Tags Property Node.
I believe I ALMOST have it, but I can't figure out how to get rid of the multiple 0EPS nodes when I run my code. Wondered if you (or anyone else) could help.
06-08-2012 09:06 AM
Eric,
The code looks like it's coming along well! At first glance I cannot see why this behavior would be happening. I suspect it has something to do that you are statically assigning the 0EPS tag. Ideally, everything would be programmatically tagged, row by row.
You would check each column in row 0, if there is no tag created, then add one. If there is continue on to the next column placing new tag under the proper parent tag. It seems at the moment that column zero is not being compared to the existing parent tag, a new one is simply being added for each child element.
-Nick-
06-08-2012 09:48 AM
Nick,
I believe I have it although I get the feeling all of the information is not getting implimneted into the tree. I'll have to go over this to make sure that the treeview is getting populated correctly.
Thanks for all your help.
06-08-2012 10:13 AM - edited 06-08-2012 10:21 AM
Hi,
I took a look , I think you wanted to get rid of the extra "ops" parents.
The logic on reading the parent ( minus 1 from the array) seems to be throwing the results. I put in a select that will turn off the "add tag" when there is a blank tag from reading the array at index -1.
Hope this helps.
Mark
06-18-2012 01:52 PM
Hey guys,
I've made it a little bit farther, but I've hit another snag. The third and fourth columns in my array can have one product code per shipment ID (second column) and multiple machines within the product code. I wondered how do I get around that? Use the same principles as the first two For Loops?
06-19-2012 04:23 PM
Hey Eric,
I would suggest doing what you did previously to check to see if the parent exists, if so go to the next level, but if not, then create that level. You will need to do this for every level of your tree structure possibly.
06-29-2012 12:38 PM
I GOT IT!
While the code looks ugly (it needs sub-VI's), I can at least see what is actually going on and hopefully impliment less code for the same result/solution.
For anyone that is interested, here's the code I used.
07-02-2012 09:42 AM
Eric,
Glad to hear that you got everything working!
-Nick-