cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
shampton82
Level VII

Number of elements in the tree structure

Okay, this is probably another easy one but stumped once again.  How do I determine how many boxes are in an analysis' tree?  I want to loop through the boxes to get values but don't see something I can return and then use with n items() or <=Variable in the for loop.  Also, is there a way to find the number of a specific type of box (such as col list box only)

 

Thanks for any suggestions.

Steve

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Number of elements in the tree structure

You can use Xpath() for those kind of questions.  Xpath is a language that interrogates xml, which is actually the base of the Tree Structure in JSL.

Xpath is an independent language.  You can search the internet for training for it, if you want to really use it.

Here is a simple example of finding the number of TextBoxes in a Display Tree.

Names Default To Here( 1 );
//This message applies to all display box objects
win = New Window( "test", Text Box( "my test" ) , text box("aaa"));
count=nitems(win << xpath( "//TextBox" ));

 

Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: Number of elements in the tree structure

You can use Xpath() for those kind of questions.  Xpath is a language that interrogates xml, which is actually the base of the Tree Structure in JSL.

Xpath is an independent language.  You can search the internet for training for it, if you want to really use it.

Here is a simple example of finding the number of TextBoxes in a Display Tree.

Names Default To Here( 1 );
//This message applies to all display box objects
win = New Window( "test", Text Box( "my test" ) , text box("aaa"));
count=nitems(win << xpath( "//TextBox" ));

 

Jim