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

Popup box to add variable

Hey,

I Want to save a file but i want to put a variable before my "TrendFile"

dt << save(
Route || "TrendFile-" ||"WW"||
Char( Week Of Year( Today() ) ) || "." || Char( Day ( Today() ) )|| "."|| Char( month ( Today() ) ) || "." ||Char( Year ( Today() ) )||
".txt"
);

So was going to create a popup box

nw = New Window( "Input",
H List Box( Text Box( "Input Tool ID " ), Tool = Text Edit Box() ),
Button Box( "OK",
TooID = Tool << get text;
nw << close window;

)
);

dt << save(
Route || ToolID || "TrendFile-" ||"WW"||
Char( Week Of Year( Today() ) ) || "." || Char( Day ( Today() ) )|| "."|| Char( month ( Today() ) ) || "." ||Char( Year ( Today() ) )||
".txt"
);

would this be right?

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Popup box to add variable

You need to use a Modal box for your input, otherwise the processing will not wait for the user input, before trying to Save.

nw = New Window( "Input",
	<<modal,
	H List Box( Text Box( "Input Tool ID " ), Tool = Text Edit Box() ),
	Button Box( "OK", TooID = Tool << get text )
);
If( nw["button"] == -1,
	Throw(),
	dt << save(
		Route || ToolID || "TrendFile-" || "WW" || Char( Week Of Year( Today() ) ) || "."
		 || Char( Day( Today() ) ) || "." || Char( Month( Today() ) ) || "." ||
		Char( Year( Today() ) ) || ".txt"
	)
);
Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: Popup box to add variable

You need to use a Modal box for your input, otherwise the processing will not wait for the user input, before trying to Save.

nw = New Window( "Input",
	<<modal,
	H List Box( Text Box( "Input Tool ID " ), Tool = Text Edit Box() ),
	Button Box( "OK", TooID = Tool << get text )
);
If( nw["button"] == -1,
	Throw(),
	dt << save(
		Route || ToolID || "TrendFile-" || "WW" || Char( Week Of Year( Today() ) ) || "."
		 || Char( Day( Today() ) ) || "." || Char( Month( Today() ) ) || "." ||
		Char( Year( Today() ) ) || ".txt"
	)
);
Jim