There are several new features in JMP 14, many of which expand or improve the cababilities of JSL. In this blog I will cover just a few of the new features for JSL and the Scripting Index.
HTTP Request
Do you have a data source that supports a REST API to access data? Would you like to interact with public REST API services, such as the Twitter or Google APIs? Now in JMP 14, you can access those APIs natively, using the New HTTP Request() function.
Here is a small example taken from the Scripting Index that uses a public API service to test a POST request.
Names Default To Here( 1 );
request = New HTTP Request(
url( "http://httpbin.org/post" ),
Method( "POST" ),
JSON( "\[{"username":"bob","address":"12345"}]\" )
);
data = request << Send();
After saving the string result in the data variable out to a JSON file, you can view the results in the new JSON syntax highlighted Script Editor. Once you decide how you want to handle this JSON response, you could also use any number of the JSON handling functions, such as Parse JSON, JSON to List, or JSON to Data Table.
Python Integration
Have you ever wanted to harness the power of Python from one of your JMP applications? With JMP 14’s Python integration, it’s now easier than ever.
Below is an example that creates a scatterplot of weight vs height, colored by age, using one the matplotlib Python package.
NamesDefaultToHere( 1 );
// Establish connection to Python
PythonConnection = PythonConnect();
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// Send the data table to Python as a dataframe
PythonConnection << Send( dt );
Close( dt, NoSave ); // close the JMP data table
// Submit python program that uses our data table (dataframe in python)
ml = PythonConnection << Submit(
"\[
import matplotlib.pyplot as plt
plt.scatter(dt.weight, dt.height, c=dt.age)
plt.ylabel('Height')
plt.xlabel('Weight')
plt.title('Weight vs. Height for Big Class')
plt.show(block=False)
]\"
);
// Get the graphics added by 'plt.show(...)'
plot = PythonConnection << Get Graphics( png );
// Show the graphic in a new window
pngJMP = NewWindow( "Plot", PictureBox( plot ) );
// close the plot
PythonConnection << Submit( "plt.close()" );
// disconnect from python
PythonConnection << Disconnect;

Classes
If you are a JSL programmer with an object-oriented background, or if you want to try new things in your advanced application, you might be interested in the new functionality for defining classes. Classes are like namespaces, but you can have multiple instances of them, known as objects. This allows you to create multiple instances of something like a group of display boxes, which each have their own behaviors.
These behaviors in a class are done using what is called a method. A method is very similar to what is currently known as a function, except methods can only exist within a class.
Here is an example of a simple calculator that can be added to a window multiple times, without stepping on each other’s toes.
// Define the class so we can create instances of it later
Define Class(
"Calculator",
// Define member variables
content = Empty();
num1_neb = Empty();
num2_neb = Empty();
operand_cmb = Empty();
calc_btn = Empty();
result_neb = Empty();
// _init_ is special method called when a new object is created
_init_ = Method( {},
content = H List Box(
num1_neb = Number Edit Box( 0 ),
operand_cmb = Combo Box( {"+", "- "} ),
num2_neb = Number Edit Box( 0 ),
calc_btn = Button Box( "=",
calc( operand_cmb << Get Selected(), num1_neb << Get(), num2_neb << Get() );
),
result_neb = Number Edit Box()
);
initializeValues();
);
// called from the _init_ method
initializeValues = Method( {},
num1_neb << Set( Random Integer( 10 ) );
num2_neb << Set( Random Integer( 10 ) );
);
// called when '=' button is clicked
calc = Method( {operand, n1, n2},
result = If( operand == "+",
addition( n1, n2 ),
subtraction( n1, n2 )
);
result_neb << set( result );
);
// methods called by calc
addition = Method( {n1, n2},
Return( n1 + n2 )
);
subtraction = Method( {n1, n2},
Return( n1 - n2 )
);
);
// Create multiple instances of the Calculator class
c1 = New Object( Calculator );
c2 = New Object( Calculator );
c3 = New Object( Calculator );
// Create a new window with the content of the three instances of Calculator
New Window( "Example", c1:content, c2:content, c3:content );

Using a JMP Project as an IDE
WIth JMP 14 Projects, you can easily create a tabbed view of your scripts, with an integrated log and bookmarks. This can make for great workflow management with all of your scripts for an add-in or project in one place. For more examples of taking advantage of new JMP projects features, check out the blog Stay organized with JMP 14.

I hope you enjoy all these new features in JSL for JMP 14. For more improvements in JSL, check out the Scripting section of the New Features document, available via Help > New Features.