LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to create treeview with siblings with similar name

Hi everyone
I have a problem to generate correct treeview based on XML code as below. As you can see, there are two parents with same tag which is drink, and same tag name bottle for the grandchild. 
The difference between each tag is their attribute where the first parent : drink, the attribute is VIP while the second parent : drink, the attribute is Commoners. The same goes to the grandchild where the different is the attribute. My question is, how can I write a program to differentiate the two parent / grandchild with same tag name but with different attribute.
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="SCL.xsl"?>

<drinks for="VIP" variety="2">

     <Lemonade quantity="5">
          <Sugar>5</Sugar>
          <Cordial>5</Cordial>
     </Lemonade>
     <Syrup quantity ="5">
          <Sugar>5</Sugar>
          <Cordial>5</Cordial>
     </Syrup>
</drinks>
<drinks for="Commoners" variety="1">
     <Water quantity ="50">
          <Bottle type="RO">
                <Size>Small</Size>
                <Quantity>10</Quantity>
          </Bottle>
          <Bottle type="RO">
                <Size>Medium</Size>
                <Quantity>10<Quantity>
          </Bottle>
          <Bottle type="RO">
                <Size>Large</Size>
                <Quantity>10</Quantity>
          </Bottle>
          <Bottle type="Filter">
                <Size>Small</Size>
                <Quantity>10</Quantity>
          </Bottle>
          <Bottle type="Filter">
                <Size>Medium</Size>
                <Quantity>10</Quantity>
          </Bottle>
     </Water>
</drinks>
I expect the tree to be like below
Drink
  Leomanade
     Sugar
     Cordial         
  Syrup
     Sugar
     Cordial
Drink
   Water
      Bottle
        Size
        Quantity
      Bottle
        Size
        Quantity
      .....
      .....
Please advice.

 

0 Kudos
Message 1 of 3
(2,667 Views)

The Tree Control API in the LAVA Code Repository handles this seamlessly by appending a '_[#]' to the tag.  Each of the tasks in my project (projects too, for that matter) are all the same tag which the Tree Control API makes unique for each item.

 

jimsjunk.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 2 of 3
(2,659 Views)

LAVA Tree Control API is used to control the tree, which means that you already has the tree, right? (Please correct me if I am wrong). My problem here is that I am not able to create the table. Where can I get a tutorial or guide on how to use the VI to generate tree view. Anyone??

 

 

0 Kudos
Message 3 of 3
(2,644 Views)