Community Trekker

Joined:

Nov 30, 2015

## list box and iteration

Hello,

I have a reporting showing data and structured as below:

H1 = H list box(

V1 = V list box() / V2 = V list box() / V3 = V list box() / V4 = V list box()

);

Is there a wait to script this type of structure using iteration as all the V list box are identical.

I tried to use H1 << append (vi) method but it is not working.

best regards

Lionel

5 REPLIES

Super User

Joined:

Jun 22, 2012

## Re: list box and iteration

Here is an example of how to do what I think you want, by using a JMP list as the structure that will allow iteration

``````Names Default To Here( 1 );
dt = Open( "\$SAMPLE_DATA\Big Class.jmp" );

// iteration list
iList = {};

// Create a display window
NW = New Window( "Test", ob = Outline Box( "Results" ) );

// Create multiple V List Boxes and add them to the display window
For( i = 1, i <= 4, i++,
V = V List Box( Text Box( "V List " || Char( i ) ) );
ob << append( V );
// Place the handle for each of the V List Boxes into the list
Insert Into( iList, V );
);

// Now add to the display window by referencing the V List Box of choice
iList[2] << append( Bivariate( x( dt:Height ), y( dt:Weight ) ) );
iList[4] << append( Bivariate( x( dt:Age ), y( dt:Weight ) ) );``````
Jim

Community Trekker

Joined:

Nov 30, 2015

## Re: list box and iteration

thank you and sorry for my late reply. Looks ok for me to try it :-)

Staff

Joined:

Jun 23, 2011

## Re: list box and iteration

Here is a way to obtain the original result, although I prefer Jim's approach.

``````New Window( "Test",
hlb = H List Box()
);

For( b = 1, b < 5, b++,
hlb << Append(
Eval(
Parse(
Substitute(
"vlb nnn = V List Box( Text Box( \!"Here I am!\!") )",
"nnn",
Char( b )
)
)
)
)
);``````
Learn it once, use it forever!

Community Trekker

Joined:

Nov 30, 2015

Staff

Joined:

Jun 23, 2011

## Re: list box and iteration

It never does - when you know the answer!

The key point is that we need to make a specific script as expressions or character strings and then evaluate them when they are ready. That practice is not common in programming.

Learn it once, use it forever!