cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
PS_Ato
Level III

get a list as variable for a script from a dialog box

Hi,

could you please help me with scripting. I would like to create new columns automatically. The part below "//Pad(+N_Pad) - column (start) ..." works, when the list_XRF={"DW", ..} was defined within the script and used.

But, how to create a "dialog window", that enables to enter a list with (if possible variable) items, that will be used for the following script "//Pad(+N_Pad) - column (start) ..."

 

Names Default To Here( 1 );
dt = Current Data Table(); 

list_XRF = "";

//a=b=c=d=e=f=g=h=i=j=k=l=
//a,b,c,d,e,f,g,h,i,j,k,l,

m = n = o = p = "";
New Window( "Define Pad types",
	Modal,
	<<Return Result,
	Outline Box( "Please define", Table Box( list_XRF = String Col Edit Box( "Pad types", {m, n, o, p} ) ) )
);

//Pad(+N_Pad) - column (start)
//list_XRF ={"DW", "DW", "SI", "SI"}; // pad type for each set of XRF measurements

dt << New Column( "Pad", "character", values( Repeat( list_XRF, Floor( N Rows( dt ) / N Items( list_XRF ) ) ) ) );

// Create Cumulative Frequencies
dt << New Column( "N_pad", Numeric, Continuous );
dt:N_Pad << Set Each Value( If( Row() == 1, 1, :Pad == Lag( :Pad, 1 ), Lag( :N_Pad, 1 ) + 1, 1 ) ); // end set each value
//Pad(+N_Pad) - column (end)

 

1 ACCEPTED SOLUTION

Accepted Solutions
pmroz
Super User

Re: get a list as variable for a script from a dialog box

You're almost there.  list_xrf refers to a display object and is not a list.  You have to get the list when the OK button is pushed.

m = n = o = p = "";
New Window( "Define Pad types",
	<< Modal,
	<< Return Result,
	Outline Box( "Please define", Table Box(pad_sceb = String Col Edit Box( "Pad types", {m, n, o, p} ) ) ),
	button box("OK",
		list_XRF = pad_sceb << get;
	)
);

View solution in original post

1 REPLY 1
pmroz
Super User

Re: get a list as variable for a script from a dialog box

You're almost there.  list_xrf refers to a display object and is not a list.  You have to get the list when the OK button is pushed.

m = n = o = p = "";
New Window( "Define Pad types",
	<< Modal,
	<< Return Result,
	Outline Box( "Please define", Table Box(pad_sceb = String Col Edit Box( "Pad types", {m, n, o, p} ) ) ),
	button box("OK",
		list_XRF = pad_sceb << get;
	)
);