cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
shampton82
Level VII

Possible to update an object in a non-modal window

hello,

I have a script that will bring up a column dialog and the manage spec limit platform.  I'd like to be able to click the update button and have the manage spec limit table reflect the selected columns.  I have not be able to figure this out so the work around is to have the window close and then reopen calling some global variables.

 

Can anyone propose a less cumbersome way of accomplishing this?

 

shampton82_0-1651068867161.png

 

 

Thanks for any ideas!

 


dt=current data table();

nc = N Col( dt );
lbWidth = 250;
cw=0;



if(::trigger==1,,::dtcol=dt<<get selected columns);



nw=new window("Manage specs",
				v list box(
							h list box(
								panel box("columns",
									colListData = Filter Col Selector( All, width( lbWidth ), nLines( Min( nc, 20 ) ) )
									
									
								),
								panel box("spec table",obj = dt << Manage Spec Limits( Y(eval(::dtcol)));)
								
							),
							H list box(H List Box( button box("update col selection",::trigger=1; ::dtcol =colListData << GetSelected; nw<<close window(); include("C:\Users\steve.hampton\OneDrive - Precision Castparts Corp\Desktop\JMP\Scripts\spec limits with cols.jsl"); )
													, 
													button box("append col selection",test={};newitems=colListData << GetSelected; insert into(test,::dtcol); insert into(test,newitems); ::dtcol=eval(test); ::trigger=1;nw<<close window(); include("C:\Users\steve.hampton\OneDrive - Precision Castparts Corp\Desktop\JMP\Scripts\spec limits with cols.jsl"); )
													,
													Button Box( "Close window", nw<<close window();::dtcol={}; ::trigger=0; test={}; ) 
														
													)
										)
						)
	
);

nw<<on close(::dtcol={}; ::trigger=0; test={};);

colListData << Clear selection;

colListData << character( 0 );
colListData << nominal( 0 );
colListData << ordinal( 0 );
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Possible to update an object in a non-modal window

I would do this by removing display box and then appending it again with new column list. The most difficult part is most likely getting the old list of columns in Manage Spec limits (and removing duplicated column names), below is one option what you could do:

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

// init one column for a bit easier management
col_list = {"NPN1"};

nw = New Window("",
	H List Box(
		fcl = Filter Col Selector(),
		pb = Panel Box("spec table", 
			obj = dt << Manage Spec Limits(Y(Eval(col_list)))
		),
		Button Box("Update",
			col_list = fcl << get selected;
			obj << Delete Box;
			pb << Append(obj = dt << Manage Spec Limits(Y(Eval(col_list)));)
		),
		Button Box("Append",
			old_cols = (Report(obj) << Find(Table Box(1)))[1] << Get;
			col_list = fcl << get selected;
			Insert Into(col_list, old_cols); 
			// you should most likely remove dublicates from list
			obj << Delete Box;
			pb << Append(obj = dt << Manage Spec Limits(Y(Eval(col_list)));)
		)
	)
);
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Possible to update an object in a non-modal window

I would do this by removing display box and then appending it again with new column list. The most difficult part is most likely getting the old list of columns in Manage Spec limits (and removing duplicated column names), below is one option what you could do:

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

// init one column for a bit easier management
col_list = {"NPN1"};

nw = New Window("",
	H List Box(
		fcl = Filter Col Selector(),
		pb = Panel Box("spec table", 
			obj = dt << Manage Spec Limits(Y(Eval(col_list)))
		),
		Button Box("Update",
			col_list = fcl << get selected;
			obj << Delete Box;
			pb << Append(obj = dt << Manage Spec Limits(Y(Eval(col_list)));)
		),
		Button Box("Append",
			old_cols = (Report(obj) << Find(Table Box(1)))[1] << Get;
			col_list = fcl << get selected;
			Insert Into(col_list, old_cols); 
			// you should most likely remove dublicates from list
			obj << Delete Box;
			pb << Append(obj = dt << Manage Spec Limits(Y(Eval(col_list)));)
		)
	)
);
-Jarmo
shampton82
Level VII

Re: Possible to update an object in a non-modal window

That works great!  Looks like I need to understand  "append" better.  Also, you are correct, I need to add in a check for duplicate items and remove them.