Subscribe Bookmark RSS Feed

list box and iteration

KinKame

Community Trekker

Joined:

Nov 30, 2015

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
txnelson

Super User

Joined:

Jun 22, 2012

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
KinKame

Community Trekker

Joined:

Nov 30, 2015

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

markbailey

Staff

Joined:

Jun 23, 2011

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!
KinKame

Community Trekker

Joined:

Nov 30, 2015

thank you for your reply. doesnt look like so complicated :-)

markbailey

Staff

Joined:

Jun 23, 2011

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!