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
mwechtal
Level III

Restricting Col List Box entries

I have a problem with Col List Box. I'd like to restrict the list of columns available to be selected.

I've already restricted it to Numeric and Continuous, but in my application that leaves a very long list.

For that matter, if there is another way that's easier (Column Dialog?), that would be fine too. The documentation seems limited on this. For instance, it shows that a script can be added to the Col List Box() function, but does not have an example, or describe how that would be done.

 

Using a modified example from the Scripting Index, how would I, for example, remove all column names that start with an N?

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );
New Window( "Col List Box Example 3",
	H List Box(
		ll1 = Col List Box( all,
			<< Set Data Type( "Numeric" ),
			<< Set Analysis Type( "Continuous" )),
		Button Box( "Add", ll2 << append( ll1 << get selected ) ),
		ll2 = Col List Box( "numeric", MaxItems( 1 ), nlines( 1 ) ),
		Button Box( "Remove", ll2 << remove selected )
	)
);
2 ACCEPTED SOLUTIONS

Accepted Solutions
uday_guntupalli
Level VIII

Re: Restricting Col List Box entries

@mwechtal

   How about something like this ? 

 

dt = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );

ColumnNames = dt << Get Column Names("String"); 

for(i = N Items(ColumnNames), i >= 1 , i--,
		If(!IsMissing(Regex(Char(ColumnNames[i]),"PNP*")),
			Remove From(ColumnNames,i); 
		  );
   );
ColumnNames; 

New Window( "Example", b = Button Box( "Popup Menu", Print( b << Get Menu Choice ) ) );
b << set menu items(ColumnNames);
Best
Uday

View solution in original post

vince_faller
Super User (Alumni)

Re: Restricting Col List Box entries

Check out filter col selector(). 

 

Names default to here(1);
dt = open("$SAMPLE_DATA\Big Class.jmp");
new window("Test", 
	fcs = filter col selector(dt)
);

It gives you a lot of options for reduction.  

Vince Faller - Predictum

View solution in original post

4 REPLIES 4
uday_guntupalli
Level VIII

Re: Restricting Col List Box entries

@mwechtal

   How about something like this ? 

 

dt = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );

ColumnNames = dt << Get Column Names("String"); 

for(i = N Items(ColumnNames), i >= 1 , i--,
		If(!IsMissing(Regex(Char(ColumnNames[i]),"PNP*")),
			Remove From(ColumnNames,i); 
		  );
   );
ColumnNames; 

New Window( "Example", b = Button Box( "Popup Menu", Print( b << Get Menu Choice ) ) );
b << set menu items(ColumnNames);
Best
Uday
mwechtal
Level III

Re: Restricting Col List Box entries

That wasn't exactly what I was thinking of, but it works!
vince_faller
Super User (Alumni)

Re: Restricting Col List Box entries

Check out filter col selector(). 

 

Names default to here(1);
dt = open("$SAMPLE_DATA\Big Class.jmp");
new window("Test", 
	fcs = filter col selector(dt)
);

It gives you a lot of options for reduction.  

Vince Faller - Predictum
mwechtal
Level III

Re: Restricting Col List Box entries

This will also work. I knew about filtering, but hadn't thought about scripting it.