Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
Sburel
Level III

Issue with Select where function when using a column referenced in a list

Good Morning,

 

I have a very simple example which I cannot figure out.

 

I'm using an UI to select some column. I reference the selected column at some later point in the script. In all case the syntax I use to extract the column name from the list created works except in one (baffling) case when used in conjunction with 'select where'.

 

I can't figure out why the column designation syntax fails when it used in conjunction with select where. In the unlikely event where 'select where' is incompatible with the syntax column (d[1]) (for d={"test_article}). A suggestion for an alternative syntax would be appreciate.

 

Best,

 

Sebastien

 

New Table( "Select where - test",
	Add Rows( 4 ),
	New Column( "test_article",
		Character,
		"Nominal",
		Set Values( {"PBS", "PBS", "123", "123"} )
	),
	New Column( "specimen",
		Character,
		"Nominal",
		Set Values( {"brain", "cord", "brain", "cord"} )
	),
	Set Row States( [1, 1, 0, 0] )
);

dy= data table("Select where - test");

d={"test_article"};
u={"specimen"};
vari="PBS";
show(d[1]);
show(u[1]);
show(vari);

//dy<<select where(:test_article==vari); //this option spells out the column and works 
//dy<<select where(column("test_article")==vari);// this does not work

dy<<select where(column(d[1])==vari); //Fails to select row - issue  appear to be with but column(d[1)) not being recognized as column in conjunction with 'select where'

dy<<subset(
									Output Table( "10-Reference" ),
									Selected Rows( 1 ),
									columns(
										column (d[1]),// both variables extracted from the list are correctly identified as columns
										column (u[1])
									));
									
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: Issue with Select where function when using a column referenced in a list

Change your "Select Where" statement to

dy << select where( as Column( d[1] ) == vari );
Jim

View solution in original post

2 REPLIES 2
Highlighted
txnelson
Super User

Re: Issue with Select where function when using a column referenced in a list

Change your "Select Where" statement to

dy << select where( as Column( d[1] ) == vari );
Jim

View solution in original post

Highlighted
Sburel
Level III

Re: Issue with Select where function when using a column referenced in a list

It worked..obviously

Thanks!
Article Labels

    There are no labels assigned to this post.