cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
BooBee
Level III

Error in running script - Send Expects Scriptable Object in access or evaluation of 'Send' , dt <<  /*###*/get column names( string, continuous ) /*###*/

I have modified the script shared earlier by one of the contributors (thank you) so that the user can choose which data file (.jmp) file to open:

 

Names Default To Here( 1 );

// Open a dialog to choose a .jmp file to open

// Get the filename of the .jmp file to open
dt = Pick File("Select a .jmp file to open", "", {"JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, "");

// If the user did not select a file, exit the script
If( Is Missing( dt ),
	Throw(), 
	// Else Open the selected file
	Open( dt )
);

// Get all of the numeric column's names
colNameList = dt << get column names( string, continuous );

// Take the data from rows 1 & 2 and create the Spec Limits column property
For Each( {col}, colNameList,
	Eval(
		Substitute(
				Expr(
					Column( dt, col ) << set property(
						"Spec Limits",
						{LSL( _LSL_ ), USL( _USL_ ), Show Limits( 1 )}
					)
				),
			Expr( _LSL_ ), As Column( dt, col )[1],
			Expr( _USL_ ), As Column( dt, col )[2]
		)
	)
);

// Exclude and Hide row 1 & 2 to eliminate them from Distributions
dt << Select rows( {1,2} );
dt << hide and exclude;

// Run the Distribution Platform
dt << Distribution( column( eval(colNameList) ));

When running the script, I ran into the following error:

Send Expects Scriptable Object in access or evaluation of 'Send' , dt <<  /*###*/get column names( string, continuous ) /*###*/

It seemed there is a problem with the dt << get columns names?


I have also attached a copy of the data file which I would like to process. 1st and 2 rows of data are the LSL and USL respectively, which I do not want to be included as part of the data. But rather they are used to plot the LSL and USL lines in the Distribution graph.

 

Appreciate any help from the community. Thank you!

3 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: Error in running script - Send Expects Scriptable Object in access or evaluation of 'Send' , dt <<  /*###*/get column names( string, continuous ) /*###*/

The variable "dt" is the issue.  You are using it in your Pick File() as the result of the pick.  It therefore will have the value of the  path and name of the file you want to open, like

     "C:\Documents\myfile.jmp"

This is very appropriate for your Open() function,

Open( dt )

since the Open() function needs to have the path and file name.

However, after opening the data table, "dt" is used as the object of the message, get column names()

colNameList = dt << get column names( string, continuous );

The get column names() message needs to be applied to a data table, not to a path and file name.

Your JSL will run if you change your Open() function call to

dt = Open( dt )

The variable will be changed to take on the value 

     Data Table( "the name of the data table" )

which will be the form needed for the remainder of your JSL

Jim

View solution in original post

txnelson
Super User

Re: Error in running script - Send Expects Scriptable Object in access or evaluation of 'Send' , dt <<  /*###*/get column names( string, continuous ) /*###*/

Once Spec Limits Column Properties are set, and the Show(1), element is specified, then by default, JMP will change the axis values for each graph, to include all data points and all specified Spec Limits

txnelson_0-1706077222176.png

 

Jim

View solution in original post

txnelson
Super User

Re: Error in running script - Send Expects Scriptable Object in access or evaluation of 'Send' , dt <<  /*###*/get column names( string, continuous ) /*###*/

Yes, all that needs to be done is to loop across the output and adjust each of the axes.  See below

names default to here(1);

// Get the filename of the .jmp file to open
dt = Pick File("Select a .jmp file to open", "", {"JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, "");

// If the user did not select a file, exit the script
If( Is Missing( dt ),
    Throw(),
    // Else Open the selected file
    dt = Open( dt )
);

// Get all of the numeric column's names
colNameList = dt << get column names( string, continuous );

// Take the data from rows 1 & 2 and create the Spec Limits column property
For Each( {col}, colNameList,
    Eval(
        Substitute(
            Expr(
                Column( dt, col ) << set property(
                    "Spec Limits",
                    {LSL( _LSL_ ), USL( _USL_ ), Show Limits( 1 )}
                )
            ),
            Expr( _LSL_ ), As Column( dt, col )[1],
            Expr( _USL_ ), As Column( dt, col )[2]
        )
    )
);

// Exclude and Hide row 1 & 2 to eliminate them from Distributions
dt << Select rows( {1,2} );
dt << hide and exclude(1);

// Run the Distribution Platform
dist = dt << Distribution( column( eval(colNameList) ));

// Loop across the output and addjust the axes 
rdist = dist << report;
For Each( {col, i}, colNameList,
	offset = (Column( col )[2] - Column( col )[1]) * .1;
	myMin = Column( col )[1] - offset;
	myMax = Column( col )[2] + offset;
	// Adjust Min and Max Y-axis
	rdist[axis box( i )] << Min( myMin ) << Max( myMax );
);
Jim

View solution in original post

11 REPLIES 11
txnelson
Super User

Re: Error in running script - Send Expects Scriptable Object in access or evaluation of 'Send' , dt <<  /*###*/get column names( string, continuous ) /*###*/

The variable "dt" is the issue.  You are using it in your Pick File() as the result of the pick.  It therefore will have the value of the  path and name of the file you want to open, like

     "C:\Documents\myfile.jmp"

This is very appropriate for your Open() function,

Open( dt )

since the Open() function needs to have the path and file name.

However, after opening the data table, "dt" is used as the object of the message, get column names()

colNameList = dt << get column names( string, continuous );

The get column names() message needs to be applied to a data table, not to a path and file name.

Your JSL will run if you change your Open() function call to

dt = Open( dt )

The variable will be changed to take on the value 

     Data Table( "the name of the data table" )

which will be the form needed for the remainder of your JSL

Jim
BooBee
Level III

Re: Error in running script - Send Expects Scriptable Object in access or evaluation of 'Send' , dt <<  /*###*/get column names( string, continuous ) /*###*/

Thank you for your clear explanation. I understand what you meant when you said dt originally took on the name of the path and filename, which then renders it unusable for when I tried to get the column names. I should therefore perform:

 

dt = Open( dt )

 

So that the data table is loaded with the appropriate data from the file for proper processing.

 

May I also ask if I would like the script to adjust the individual Maximums and Minimums of the Y axes of each graph, how can I do it?

I would like to find the absolute range between the USL and LSL, then put the Max Y at USL + 0.1*range, Min Y as LSL-0.1*range. The idea is to have a consistent presentation for that the distribution graphs.

txnelson
Super User

Re: Error in running script - Send Expects Scriptable Object in access or evaluation of 'Send' , dt <<  /*###*/get column names( string, continuous ) /*###*/

Once Spec Limits Column Properties are set, and the Show(1), element is specified, then by default, JMP will change the axis values for each graph, to include all data points and all specified Spec Limits

txnelson_0-1706077222176.png

 

Jim
BooBee
Level III

Re: Error in running script - Send Expects Scriptable Object in access or evaluation of 'Send' , dt <<  /*###*/get column names( string, continuous ) /*###*/

I hear you said that once we put in the Show( ) function in the script, JMP will adjust the Max and Min of the axis to take into account of the all the data points and the LSL and USL.

But say if I want to define Max and Min manually (using the formulae I mentioned earlier) through the script, is it doable?

txnelson
Super User

Re: Error in running script - Send Expects Scriptable Object in access or evaluation of 'Send' , dt <<  /*###*/get column names( string, continuous ) /*###*/

It is easily done.  Look in the Scripting Index and look at the messages available for the AxisBox object.  You can set the Min and Max values.  There are examples in the index illustrating the JSL.

Jim
BooBee
Level III

Re: Error in running script - Send Expects Scriptable Object in access or evaluation of 'Send' , dt <<  /*###*/get column names( string, continuous ) /*###*/

I added the following lines to see if I can get the distribution graphs to change the Max and Min of their Y axes:

// Adjust Min and Max Y-axis
dist = dt << Set Axis(
	Min( -10 ),
	Max( 10 )
);

There seem to be no effect. Am I doing it wrong?

The complete script:

// Get the filename of the .jmp file to open
dt = Pick File("Select a .jmp file to open", "", {"JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, "");

// If the user did not select a file, exit the script
If( Is Missing( dt ),
    Throw(),
    // Else Open the selected file
    dt = Open( dt )
);

// Get all of the numeric column's names
colNameList = dt << get column names( string, continuous );

// Take the data from rows 1 & 2 and create the Spec Limits column property
For Each( {col}, colNameList,
    Eval(
        Substitute(
            Expr(
                Column( dt, col ) << set property(
                    "Spec Limits",
                    {LSL( _LSL_ ), USL( _USL_ ), Show Limits( 1 )}
                )
            ),
            Expr( _LSL_ ), As Column( dt, col )[1],
            Expr( _USL_ ), As Column( dt, col )[2]
        )
    )
);

// Exclude and Hide row 1 & 2 to eliminate them from Distributions
dt << Select rows( {1,2} );
dt << hide and exclude;

// Adjust Min and Max Y-axis
dist = dt << Set Axis(
	Min( -10 ),
	Max( 10 )
);

// Run the Distribution Platform
dist = dt << Distribution( column( eval(colNameList) ));
txnelson
Super User

Re: Error in running script - Send Expects Scriptable Object in access or evaluation of 'Send' , dt <<  /*###*/get column names( string, continuous ) /*###*/

The syntax for setting the Max value for the Axis is not

dist = dt << Set Axis(
	Min( -10 ),
	Max( 10 )
);

The Scripting Index for changing settings for an AxisBox() is shown below

txnelson_0-1706165286166.png

The JSL example shows the correct syntax to use

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = Bivariate( Y( :weight ), X( :height ), FitLine );
rbiv = biv << report;
axisbox = rbiv[axis box( 1 )];
axisbox << Max( 120 );

Here is a slight modification of the example syntax, where the setting of the axis is for a Histogram plot, similar to what you have indicated you want to use in your script.

// Run the Distribution Platform
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dist = dt << Distribution( column( :weight ));
rdist = dist << report;
axisbox = rdist[axis box( 1 )];
axisbox << Max( 200 ) << Min( 50 );

You can learn more about the manipulating of the display output in the Scripting Guide's section on Display Trees.

 

 

 

Jim
BooBee
Level III

Re: Error in running script - Send Expects Scriptable Object in access or evaluation of 'Send' , dt <<  /*###*/get column names( string, continuous ) /*###*/

Made a small progress by changing the script to the following:

// Get the filename of the .jmp file to open
dt = Pick File("Select a .jmp file to open", "", {"JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, "");

// If the user did not select a file, exit the script
If( Is Missing( dt ),
    Throw(),
    // Else Open the selected file
    dt = Open( dt )
);

// Get all of the numeric column's names
colNameList = dt << get column names( string, continuous );

// Take the data from rows 1 & 2 and create the Spec Limits column property
For Each( {col}, colNameList,
    Eval(
        Substitute(
            Expr(
                Column( dt, col ) << set property(
                    "Spec Limits",
                    {LSL( _LSL_ ), USL( _USL_ ), Show Limits( 1 )}
                )
            ),
            Expr( _LSL_ ), As Column( dt, col )[1],
            Expr( _USL_ ), As Column( dt, col )[2]
        )
    )
);

// Exclude and Hide row 1 & 2 to eliminate them from Distributions
dt << Select rows( {1,2} );
dt << hide and exclude;

// Adjust Min and Max Y-axis
//dist = dt << Set Axis(
//	Min( -10 ),
//	Max( 10 )
//);

// Run the Distribution Platform
dist = dt << Distribution( column( eval(colNameList) ));

// Adjust Min and Max Y-axis
rdist = dist << report;
axisbox = rdist[axis box( 1 )];
axisbox << Min( 0 );

With the change, I managed to change the Min of the first distribution chart to "0" but the rest of the changes remained unchanged. May I know how should I should change the code such that Min setting can be applied to the all the charts?

BooBee
Level III

Re: Error in running script - Send Expects Scriptable Object in access or evaluation of 'Send' , dt <<  /*###*/get column names( string, continuous ) /*###*/

It will seem that I will need some sort of loop such that the axis settings are applied to all the distribution charts?