cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Andyon98
Level II

How can I append to this Col List Box?

This code is supposed to add each name into the list box but it doesn't work. Has it got to do with the data type? 

 

Also, if you're wondering why im using the 1st element, its because I wanted to populate other columns within that list for E.G -> col[2] = column(dt, "height");

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

col = {};
col[1] = column(dt, "name");

New Window( "Col List Box Example", 
	LstBox = Col List Box(, width( 250 )),
		for(i=1, i<= N Rows(dt), i++,
			LstBox << append(Eval(col[1][i]));
		),
);
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How can I append to this Col List Box?

The issue is that you are using

Col List Box()

and attempting to place non column names into the list.(i.e. Katie, Louise, etc. are not column names)

To do what you want, you need to use

List Box()
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

col = {};
col[1] = column(dt, "name");

New Window( "List Box Example", 
	LstBox = List Box(, width( 250 )),
		for(i=1, i<= N Rows(dt), i++,
			LstBox << append(Eval(col[1][i]));
		),
);
Jim

View solution in original post

2 REPLIES 2
jthi
Super User

Re: How can I append to this Col List Box?

Col List Box is used for Columns. If you want to add names in the name column, you should use List Box:

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

col = {};
col[1] = column(dt, "name");

New Window( "Col List Box Example", 
	LstBox = List Box(, width( 250 )),
		for(i=1, i<= N Rows(dt), i++,
			LstBox << append(Eval(col[1][i]));
		),
);

jthi_0-1658854985922.png

 

-Jarmo
txnelson
Super User

Re: How can I append to this Col List Box?

The issue is that you are using

Col List Box()

and attempting to place non column names into the list.(i.e. Katie, Louise, etc. are not column names)

To do what you want, you need to use

List Box()
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

col = {};
col[1] = column(dt, "name");

New Window( "List Box Example", 
	LstBox = List Box(, width( 250 )),
		for(i=1, i<= N Rows(dt), i++,
			LstBox << append(Eval(col[1][i]));
		),
);
Jim