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

Cannot perform Boolean logic using jmp script on table formula

Hi,

I am trying to run a simple script that will select and then hide and exclude points that are greater than 100 mm in radial distance from the center. 

 

To simplify debugging, I split this into two scripts: the first one generates a column with the radial distance Radial = (x^2 + y^2)^(1/2) formula and the second evaluates this formula, selecting and hiding rows where Radial > 100.

 

Unfortunately this does not work. For some very strange reason, evaluation only works on this formula up to a certain value. Radial > (anything over 30) selects all rows.

 

I can see two solutions:

1) Write values into the Radial column, not the formula itself. (Values are evaluated properly, the formula is not). Not sure how to do this.

2) Understand and correct the problem so that the formula can be evaluated against a value greater than 30.

 

Either a scripting answer or interactive explanation would be acceptable. Would like to resolve this problem and learn from it.

Thanks!

Dave

 

// script for creating the Radial column
dt1 = Current Data Table (); dt1 << New Column( "Radial", Formula ((X coordinate^2 + Y coordinate^2)^(1/2)));

// script for evaluating the Radial formula
dt =Current Data Table();
dt << Clear Row States;
dt << Select where(Radial < 100);
dt << hide and exclude;
1 ACCEPTED SOLUTION

Accepted Solutions
dsoltz1
Level II

Re: Cannot perform Boolean logic using jmp script on table formula

Thanks for replying Jeff.

 

Pasting the last line of your script into mine did not resolve the problem. However I was able to come with a solution by changing the name of the column to "Radial 1" and adding a line with Eval Formula at the end. Not sure why this works. The data table is about 1,300 rows with 15 columns, each number has a width of 10 to 12.

 

The following two scripts work. Am pasting them in their entirety. The other lines evaluate pit depth and distribution.

Any idea why the modifications worked? I have been at this for most of the day.

Script 1: Create "Pits Only" and "Radial 1" columns

dt1 = Current Data Table ();
dt1 << Clear Row States;
dt1 << New Column( "Pits Only", Formula (If( :Name( "Height (mm)" ) <= 0,	:Name( "Height (mm)"), 0 )) );
dt1 << New Column( "Radial 1", Formula ((X coordinate^2 + Y coordinate^2)^(1/2)));
dt1 << Eval Formula;
obj = dt1 << Distribution( Column( :Pits Only), Horizontal Layout( 1 ), Count Axis);

Script 2: Hide and Exclude rows with Pits Only > 10 or Radial 1 > 100 or Radial 1 < 30

dt =Current Data Table();
dt << Clear Row States; 
	win = New Window( "Feature Depth" , <<Modal, <<Return Result,
	Text Box( "Input Min Feature Depth" ),
	minfeat_abs = Number Edit Box( 4 ), 
 );

 mf = win["minfeat_abs"];

 mf = -mf/1000;

// show (mf);

dt << Select where((Radial 1> 100) | (Radial 1< 30) | (Pits Only > mf));
dt << hide and exclude;

 

View solution in original post

4 REPLIES 4
dsoltz1
Level II

Re: Cannot perform Boolean logic using jmp script on table formula

script for creating the Radial column

dt1 = Current Data Table ();
dt1 << Clear Row States;
dt1 << New Column( "Radial", Formula ((X coordinate^2 + Y coordinate^2)^(1/2)));

script for evaluating the Radial formula

dt =Current Data Table();
dt << Clear Row States; 
dt << Select where(Radial < 100);
dt << hide and exclude;
Jeff_Perkinson
Community Manager Community Manager

Re: Cannot perform Boolean logic using jmp script on table formula

I'm afraid I'm having trouble reproducing any problem here. Here's the script I used to test with.

 

dt1 = New Table( "Community 416651 Select Where",
	Add Rows( 1000000 ),
	New Column( "x coordinate",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( Sequence( 5, 100, 5 ) ),
		Set Selected
	),
	New Column( "y coordinate",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( Sequence( 5, 100, 5, 20 ) ),

	)
);

dt1 << New Column( "Radial",
	Formula(
		(X coordinate ^ 2 + Y coordinate ^ 2) ^ (1 / 2)
	)
);

dt1 << Select where( Radial < 60 );

 

So, we're going to need a little more detail about your script and your data table.

 

How big is your data table? What else is your script doing?

 

-Jeff
dsoltz1
Level II

Re: Cannot perform Boolean logic using jmp script on table formula

Thanks for replying Jeff.

 

Pasting the last line of your script into mine did not resolve the problem. However I was able to come with a solution by changing the name of the column to "Radial 1" and adding a line with Eval Formula at the end. Not sure why this works. The data table is about 1,300 rows with 15 columns, each number has a width of 10 to 12.

 

The following two scripts work. Am pasting them in their entirety. The other lines evaluate pit depth and distribution.

Any idea why the modifications worked? I have been at this for most of the day.

Script 1: Create "Pits Only" and "Radial 1" columns

dt1 = Current Data Table ();
dt1 << Clear Row States;
dt1 << New Column( "Pits Only", Formula (If( :Name( "Height (mm)" ) <= 0,	:Name( "Height (mm)"), 0 )) );
dt1 << New Column( "Radial 1", Formula ((X coordinate^2 + Y coordinate^2)^(1/2)));
dt1 << Eval Formula;
obj = dt1 << Distribution( Column( :Pits Only), Horizontal Layout( 1 ), Count Axis);

Script 2: Hide and Exclude rows with Pits Only > 10 or Radial 1 > 100 or Radial 1 < 30

dt =Current Data Table();
dt << Clear Row States; 
	win = New Window( "Feature Depth" , <<Modal, <<Return Result,
	Text Box( "Input Min Feature Depth" ),
	minfeat_abs = Number Edit Box( 4 ), 
 );

 mf = win["minfeat_abs"];

 mf = -mf/1000;

// show (mf);

dt << Select where((Radial 1> 100) | (Radial 1< 30) | (Pits Only > mf));
dt << hide and exclude;

 

txnelson
Super User

Re: Cannot perform Boolean logic using jmp script on table formula

I am doing a bit of guessing, but I believe that your issue with Radial vs Radial 1 is your not scoping your column variable correctly.  In your statement

dt << Select where((Radial 1> 100) | (Radial 1< 30) | (Pits Only > mf));

you should be placing a ":" in front of the column names :Radial 1 and :Pits Only.  The reason that the script is working with Radial 1, is that there is not a memory variable called Radial 1, in which JMP can get confused with.  It is my assumption that at some point in your coding attempts, that you in accidently created a memory variable of Radial, so when you specified

dt << Select where((Radial> 100) | (Radial< 30) | (Pits Only > mf));

JMP was replacing value for Radial with the memory variables value, not the column Radial's value.

Jim