JMP 14にはいくつかの新機能があり、それらの多くはJSLの機能を拡張または改善します。このブログでは、JSLとScripting Indexの新機能のいくつかについて説明します。
HTTPリクエスト
データにアクセスするためのREST APIをサポートするデータソースがありますか?TwitterやGoogle APIなどの公開REST APIサービスと対話しますか?JMP 14では、New HTTP Request()関数を使用してこれらのAPIにネイティブにアクセスできます。
これは、POSTリクエストをテストするためにパブリックAPIサービスを使用するScripting Indexの抜粋です。
Names Default To Here( 1 );
request = New HTTP Request(
url( "http://httpbin.org/post" ),
Method( "POST" ),
JSON( "\[{"username":"bob","address":"12345"}]\" )
);
data = request << Send();
文字列の結果をデータ変数にJSONファイルに保存した後、新しいJSON構文で強調表示されたスクリプトエディタで結果を表示できます。このJSONレスポンスの処理方法を決定したら、Parse JSON、JSON to List、JSON to Data Tableなど、JSON処理関数をいくつでも使用することもできます。
Pythonの統合
あなたはあなたのJMPアプリケーションの1つからPythonの力を利用したいと思ったことがありますか?JMP 14のPython統合により、今までになく簡単になりました。
以下は、matplotlib Pythonパッケージの1つを使用して、年齢ごとに色分けされた体重と身長の散布図を作成する例です。
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;

クラス
オブジェクト指向のバックグラウンドを持つJSLプログラマーである場合、または高度なアプリケーションで新しいことを試したい場合は、クラスを定義するための新しい機能に興味があるかもしれません。クラスは名前空間に似ていますが、オブジェクトと呼ばれる複数のインスタンスを持つことができます。これにより、それぞれ独自の動作を持つ表示ボックスのグループのようなものの複数のインスタンスを作成できます。
クラス内のこれらの動作は、いわゆるメソッドを使用して行われます。メソッドは、クラス内にしか存在できないことを除けば、現在関数として知られているものと非常によく似ています。
これは、お互いのつま先を踏まずにウィンドウに複数回追加できる単純な計算機の例です。
// 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 );

IDEとしてのJMPプロジェクトの使用
JMP 14プロジェクトでは、統合されたログとブックマークを使用して、スクリプトのタブ付きビューを簡単に作成できます。これにより、アドインまたはプロジェクト用のすべてのスクリプトを1か所にまとめてワークフロー管理を効率化できます。新しいJMPプロジェクト機能を利用する他の例については、ブログをチェックしてください。 JMP 14で組織化を維持 。

JSL for JMP 14のこれらすべての新機能をお楽しみに。JSLのその他の改良点については、[ヘルプ]> [新機能]で利用可能な新機能ドキュメントの[スクリプト]セクションをご覧ください。