cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
jade
Level III

Problem of Declare a variable

Hi, everyone

I have 2 script here:
First script is using the dialog () function without the search feature.
While second script is using the new window () function with the search feature which is improvement script.

The problem that I face is when I run the first script(the dialog () function) is it able to return the value and can get the bin information after click OK button.

 

 

 

 

While for the second script, i able to search the product by using word, but the problem is when i click the OK button, it unable to get the product's information.

I not sure what problem cause me unable to capture the product's information.
Does anyone can help me see my script?
Any answer is appreciate.

Thanks.

 

 

 

9 REPLIES 9

Re: Problem of Declare a variable

The deprecated Dialog() function automatically returns a list with assignments for you to unload. The New Window() function also returns a list but by default it includes only an indication of which button was clicked. This behavior is the same as the older Dialog() function.

There are now three ways to unload a dialog box when using New Window(). For details, select Help > Books > Scripting Guide. Then see the explanation of Extract Values from Window starting on page 444. The first method uses the inline message << Return Result. This message causes the window to behave like the old dialog. You should not have to change anything else in your second script.

jade
Level III

Re: Problem of Declare a variable

Thanks @Mark_Bailey for reply.

For the second script is the improvement of the first script, so now i need to use the second script to run the program.

You mention I no need change anything in my second script. But how can I capture the information of the product? I no need declare any variable in order to capture the value? Because when i run "aa" in the second script, it return empty.

And i can't find the explanation of extract value from window in scripting book, i using jmp 12 version. 

Thanks.

Re: Problem of Declare a variable

I didn't mean it literally. I meant that your New Window() approach is basically correct. You need to make specific changes (that is, assign result of a function that creates a display box to a variable) so that it behaves like the old Dialog() function (returns a list of assignments to unload).

You did not read the section of the scripting guide that I cited. It shows you exactly what you have to do. Then my explanation will be clear.

jade
Level III

Re: Problem of Declare a variable

Hi, Thanks @Mark_Bailey for reply.

Well, i have use the << Return Result in my script, it really behave like the dialog() function, it can extract the products when I run the program.

But I still have face one problem, is there any function that can return a number in the New Window() Function?

 

Thanks.

 

Re: Problem of Declare a variable

How are you unloading the variable aa from the dialog? Also, how are you using this variable aa after the dialog box is dismissed?

jade
Level III

Re: Problem of Declare a variable

The varaible aa  that i use is from New Window.
I use the << Return Result to capture the value aa.

 

Re: Problem of Declare a variable

You can use a Combo Box in New Window():

Names Default To Here( 1 );
New Window( "Example",
	cb = Combo Box(
		{"One", "Two", "Three"},
		selection = cb << Get Selected();
		Print( "Selected: " || selection );
	)
);

This object is meant for one selection. The List Box() creates an object for zero or more selections. The choice between these two objects depends on the UI design and needs.

 

Re: Problem of Declare a variable

This example is based on the explanation cited above from the JMP Scripting Guide. It shows how the New Window() function will behave like the deprecated Dialog() function and return a list of assignments that can be used to obtain the number entered by the user.

win = New Window( "Set a Value",
	<<Modal,
	<<Return Result,
	Text Box( "Set this value" ),
	var number = Number Edit Box( 42 ),
	Button Box( "OK" ),
	Button Box( "Cancel" )
);

Show( win );

If( win["Button"] == -1, Throw( "User cancelled" ) );

Remove From( win );
Eval List( win );

Show( var number );

 

jade
Level III

Re: Problem of Declare a variable

I had solve the above problem.
Thanks a lot ya