cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
Tzu-Chun
Level III

Connect Column Names with String Col Box

Hi JSL Experts,

 

I would like to connect column names with a String Col Box with the example below. The Col List Box will update the column status (add/delete/rename) automatically which is the functionality I need for the String Col Box. So, I create a Col List Box and then connect it to the String Col Box.

 

It seems works, but I would like to hide the Col List Box or run it at the background. However, when I set  Box1<<visibility(Hidden), then it lost the connect from the data table. Any suggestions would be greatly appreciated.

 

 

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
New window("Connect dt with String Col box",
	Box1=Col list box(dt, all,
		on change(
			Cols=Box1<<get items;
			Box2<<set values(Cols);
		)
	),
	Table box(
		Box2=String col box("Columns",Cols=Box1<<get items)
	)
);

Best,

 

Tzu-Chun Wu

 

1 ACCEPTED SOLUTION

Accepted Solutions
David_Burnham
Super User (Alumni)

Re: Connect Column Names with String Col Box

You can subscribe to a table to detect changes - this avoids using Col List Box but is a complex route.

 

Perhaps you could just place the display box inside a closed outline box ?

 

OutlineBox("-", <<close(1),
    ColListBox( ... )
)
-Dave

View solution in original post

4 REPLIES 4
David_Burnham
Super User (Alumni)

Re: Connect Column Names with String Col Box

Not really sure what you are trying to do here.  Do you really want a Col List Box or are you just using it to get a list of columns.  If the later, then you can just write:

col = dt << getColumnNames(string)

where dt is a reference to a data table, for example:

dt = currentDataTable();
-Dave
Tzu-Chun
Level III

Re: Connect Column Names with String Col Box

Hi Dave,

 

I would like to create a string col box which reflect the column change of a data table. For example, if I have columns {"Column 1", "Column 2"} and add a new column "Column 3" later, it will be great if the string column box can be updated automatically without any other actions.

 

dt=new table("Table",
	New column("Column 1"),
	New column("Column 2")
);

New window("",
	Table box(
		String Col box("Columns", dt<<get column names("String")),
		Col List box(dt, all)
	)
);
wait(1);

dt<<new column("Column 3");

 

The "get column names" is a good idea, but the string col box will not be updated automatically. Here is the comparison between String Col box and Col list box.

 

before adding column 3

Tzu-Chun_0-1591638874821.png

 

After Adding Column 3

Tzu-Chun_1-1591638924503.png

 

Help the details helps.

 

Tzu-Chun

 

 

David_Burnham
Super User (Alumni)

Re: Connect Column Names with String Col Box

You can subscribe to a table to detect changes - this avoids using Col List Box but is a complex route.

 

Perhaps you could just place the display box inside a closed outline box ?

 

OutlineBox("-", <<close(1),
    ColListBox( ... )
)
-Dave
Tzu-Chun
Level III

Re: Connect Column Names with String Col Box

Hi Dave,

 

The Outline Box approach does not work, but the Subscribe function is exactly what I need. Thanks again for your suggestion and help. If someone is interested in the Subscribe function, please check the link https://www.jmp.com/support/help/14/subscribe-to-a-data-table.shtml 

 

Tzu-Chun