For the latest version of JMP Help, visit JMP.com/help.


Publication date: 04/21/2023

JSL Terminology

Before you begin creating scripts, you should become familiar with basic JSL terms used throughout the Scripting Guide.

Operators and Functions

An operator is one- or two-character symbol (such as + or =) for features such as common arithmetic actions, scoping names, regular expressions, concatenating, and subscripting.

A function is a command that might contain additional information for the function to use.

Certain JSL functions work the same as operators but provide access to more complex actions. For example, the following two lines are equivalent:

2 + 3; // returns 5
Add( 2, 3 ); // returns 5

The first line uses the + operator. The second line uses the Add() function equivalent.

Although all JSL operators have function equivalents, not all functions have operator equivalents. For example, Sqrt(a) can be represented only by the Sqrt() function.

Note: In previous versions of JMP and its documentation, the terms operators and functions were used interchangeably. Now each term has a specific meaning.

Objects and Messages

An object is a dynamic entity in JMP, such as a data table, a data column, a platform results window, a graph, and so on. Most objects can receive messages that instruct the object to perform some action on itself.

A message is a JSL expression that is directed to an object. That object knows how to evaluate the message. In the following example, dt is the data table object. << indicates that a message follows. In the following example, the message tells JMP to create a summary table with the specified variables.

dt << Summary( Group( :age ), Mean( :height ) )

In this expression, dt is the name of a variable that contains a reference to a data table. You could use any name for this variable. The Scripting Guide commonly uses dt to represent data table references. Here are some of the more common names used to represent references to certain objects:

Abbreviation

Object

dt

data table

col

column in a data table

colname

the name of a column in a data table

obj

an object

db

display box

These variables are not pre-assigned references. Each one must be assigned prior to its use. In the following example, the global variable named A is assigned the value “Hello, World”. When the Show( A ) command is processed, the result is the value of A.

A = "Hello, World";
Show( A );

A = "Hello, World";

Arguments and Parameters

An argument is additional information that you can provide to a function or message. For example, in Root(25), 25 is an argument to the Root() function. Root() acts on the argument that you provide and returns the result: 5.

Programming and scripting books commonly talk about parameters as well. A parameter is a description of the argument that a function accepts. For example, the general specification for Root() might be Root( number ), where number is the parameter.

Parameter and argument express two perspectives of the same concept: information that a function needs.

For simplicity in the Scripting Guide, we use the word argument in both cases.

A named argument is an optional argument that you select from a predetermined set and explicitly define. For example, title("My Line Graph") in the Graph Box() function is a named argument because the title is explicitly defined as such.

Graph Box( title( "My Line Graph" ),
		Frame Size( 300, 500 ),
		Marker( Marker State( 3 ), [11 44 77], [75 25 50] );
		Pen Color( "Blue" );
		Line( [10 30 70], [88 22 44] ));

Note that the Frame Size() arguments 300 and 500 are not named. The position of these arguments implies meaning; the first argument is always the width, the second argument is always the height.

Optional Arguments

Functions and messages require certain arguments, and other arguments are optional. You can include them, but you do not have to. In specifications, optional arguments are enclosed in angle brackets. For example:

Root( x, <n> )

The x argument is required. The n argument is optional.

Optional arguments often have a default value. For example, for Root(), the default value of n is 2:

Code

Output

Explanation

Root( 25 )

5

Returns the square root of 25.

Root( 25, 2 )

5

Returns the square root of 25.

Root( 25, 3 )

2.92401773821287

Returns the cube root of 25.

Or and the Vertical Bar Symbol

A single vertical bar (|) represents a logical OR. For brevity, | represents the word or when referring to alternative values.

For example, a pathname can be either absolute or relative. When you see an argument such as absolute|relative, this means that you enter either one of the following two options:

absolute indicates an absolute pathname.

relative indicates a relative pathname.

More than two options can also be strung together with a vertical bar in this way.

Script Formatting

Whitespace characters (such as spaces, tabs, and newlines) and capitalization are ignored in JSL. This means that the following two expressions are equivalent:

Expression 1:

sum = 0;
For( i = 1, i <= 10, i++,
	sum += i;
	Show( i, sum );
);
 

Expression 2:

Sum = 0;
For( i = 1, i <= 10, i++,
	Sum += i;
	Show( i, Sum );
);

You can format your script in any way that you like. However, the script editor can also format your script for you. The Scripting Guide uses the script editor’s default formatting for capitalization, spaces, returns, tabs, and so on. See Work with the Script Editor for more information about using the script editor.

Note: The only white space exception is two-character operators (such as <= or ++). The operators cannot be separated by a space.

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).