cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
Ressel
Level VI

Updating column list box using list stored in variable not working as expected. Is this how it is meant to be?

I am trying to correct previous "sins" in a script I wrote by updating it with unambiguous references, so that the script refers to the one table I (want to) tell it to, even though another table may be the current (or an "interfering") table. I've tried to reconstruct the problem below.

 

Names Default To Here( 1 );

// this is the table i want to work with
dt = New Table( "Target table", invisible,
	Add Rows( 3 ),
	New Column( "Name_1",
		Character( 1 ),
		"Nominal",
		Set Values( {"A", "B", "C"} ),
		Set Display Width( 45 )
	),
	New Column( "Name_2",
		Character( 1 ),
		"Nominal",
		Set Values( {"X", "Y", "Z"} ),
		Set Display Width( 45 )
	),
	New Column( "NumericRight",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [1, 2, 3] ),
		Set Display Width( 78 )
	),
	New Column( "NumericAlso",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [7, 8, 9] )
	)
);

dt2 = New Table( "Interfering table", invisible,
	Add Rows( 3 ),
	New Column( "Name_1",
		Character( 1 ),
		"Nominal",
		Set Values( {"D", "E", "F"} ),
		Set Display Width( 45 )
	),
	New Column( "Name_2",
		Character( 1 ),
		"Nominal",
		Set Values( {"U", "V", "W"} ),
		Set Display Width( 45 )
	),
	New Column( "NumericInterference",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [4, 5, 6] )
	),
	New Column( "MoreNumeric",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [7, 8, 9] )
	)
);



// get lists
lstName_1 = Associative Array( dt:Name_1 ) << Get Keys; 
lstName_2 = Associative Array( dt:Name_2 ) << Get Keys; 
colList = dt << Get Column Names( "Numeric" );
	
// window with radio buttons & col list box
New Window( "Select values",
	Show Menu( 0 ),
	Show Toolbars( 0 ), 
	Border Box( Top( 0 ), Bottom( 20 ), Left( 20 ), Right( 10 ),
		H List Box(
			
			Panel Box( "Name_1",
				Radio Box(
					Eval List( lstName_1 )
				) 
			),
			
			Panel Box( "Name_2",
				Radio Box(
					Eval List( lstName_2 )
				)
			),
			
			Panel Box( "Numeric Columns",
				clb = Col List Box(	)
			),
			clb << Append( colList ); // making me cry ...
		)
	)
);

 

What I want to see:

Ressel_1-1697225236072.png

 

What I invariably see if my "target table" is not the current table:

Ressel_0-1697225153301.png

 

What completely confuses me is that when I change the name of dt2:NumericInterference to dt2:NumericRight, I get this result:

Ressel_2-1697225490978.png

 

Why is dt2 not letting my script do the work I want it to do? Why is the name change of a column in dt2 affecting what gets into the column list box? I've tried a few variations of moving the colList variable and also tried wrapping it into Eval List(), without "luck".

 

Searching again in the community I found this Need help with populating Col List Box. If there's another solution, thanks for letting me know. Alternatively, is this how it is meant to be, and if so, what is the meaning of this?

15 REPLIES 15
hogi
Level XII

Re: Updating column list box using list stored in variable not working as expected. Is this how it is meant to be?

This is what puzzles me.

 

We learned that the Columns("height" )in 

Distribution(Columns("height"));

 is an (optional) named argument.

So, what is Columns in Distribution(Columns("height")); ?

From grammatical point of view it could be the "name" - which was given to the named argument.

But this will collide with the standard definition of name in JSL. (compare: as name(x))

I guess I am not the first one who asks this question - and I guess there is an official name for the name of a named parameter.

But I was not lucky enough to find it in the documentation.
@Mark_Bailey ?

hogi
Level XII

Re: Updating column list box using list stored in variable not working as expected. Is this how it is meant to be?

previous post:
Seems that the col list box just accepts columns from the data table which was "current" when the col list box was created.

If dt2 doesn't contain the respective column, it cannot be added.

 

I guess 

current data table(dt);
	
// window with radio buttons & col list box
New Window( "Select values",

is no option for you?

 

If not, then use

clb = Col List Box( Data Table(dt)	)

to specify which data table should be used for the col list box:

hogi_0-1697230466333.png

 

 

 

Ressel
Level VI

Re: Updating column list box using list stored in variable not working as expected. Is this how it is meant to be?

@hogi , thanks, I will also try this tomorrow and let you know the result.

Ressel
Level VI

Re: Updating column list box using list stored in variable not working as expected. Is this how it is meant to be?

@hogi, I am amazed! Thank you for your help.

  1. Making the desired table the current table works, of course. Somehow, I still wanted to avoid this.
  2. But also the below code works
Panel Box( "Numeric Columns",
	clb = Col List Box(Data Table( dt ))
),
clb << Append( colList ); // this is still required, which I find interesting, since I thought the clb was already added above via Col List Box(...)

In contrast, the below does not work. Rather, it adds the numeric columns from dt2, which makes no sense to me.

Panel Box( "Numeric Columns",
	clb = Col List Box(dt, all, << Set Data Type ( "numeric" )) // adds numeric columns from dt2 :(...
),
/*clb << Append( colList );*/ // doesn't matter whether this is commented out or not
hogi
Level XII

Re: Updating column list box using list stored in variable not working as expected. Is this how it is meant to be?

Hi @Ressel .

I have to admit, it also puzzled me a bit

 

They should have used 

Col List Box(<From Data Table(name|table reference)>

as the optional argument ... or anything else - but  different from Data Table("table name")

- kind of misleading, right?

 

After years as Jmp user one is too tempted to replace the whole expression with dt  - and thereby forget the "indicator".
On the other hand, it's nice that one can use the table reference instead of the table name as argument of Data Table

Ressel
Level VI

Re: Updating column list box using list stored in variable not working as expected. Is this how it is meant to be?

The presence and help of users like you is what lifts a lot of people, including me, up when it comes to scripting and other JMP-related skills. This is kindness and this is greatly appreciated.