Scripting Guide > Extending JMP > Share Content on JMP Live > Publish Reports or Data to JMP Live
Publication date: 07/24/2024

Publish Reports or Data to JMP Live

Using JSL, you can publish JMP reports or data tables to a JMP Live folder in a space. Individuals or groups who have access to the space and folder can see your posts.

Publish to a Space

Depending on how you want to share your post, you can publish to your personal space or any other space using a space key. To find a space’s key in JMP Live, go to the space and click About.

To publish a post to your personal space, enter a tilde (~) as a shortcut. Personal spaces always start with a tilde.

To publish a post to another space, specify the space key.

Example of Publishing to a Space

This example publishes a Graph Builder report to your personal space.

Names Default To Here( 1 );
// Open the Big Class data table.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// Run the Graph Builder table script and call the report gbsmoother.
gbsmoother = dt << Run Script( "Graph Builder Smoother Line" );
// Set up the connection to the JMP Live server.
liveconnection = New JMP Live();
// Add the gbsmoother report to content.
content = New JMP Live Content( gbsmoother );

/* Publish the content to your personal space. Use the JMP Live Connection that you established and return a JMP Live object called jmpliveresult. */

jmpliveresult = liveconnection << Publish( content, Space( "~" ) );
// Close all data tables without saving.
Close All( Data Tables, NoSave );

Create a Folder in a Space

When you create a folder, you specify where to create it (the space or folder it resides in) the folder title, and an optional description.

Example of Creating a Folder in a Space

This example creates a folder in your personal space.

Names Default To Here( 1 );
// Set up the connection to the JMP Live server.
liveconnection = New JMP Live();

/* Create a folder in your personal space with a title and a description. Use the JMP Live Connection that you established and return a JMP Live object called jmpliveresult. */

jmpliveresult = liveconnection << Create Folder( Space( "~" ), Title( "Create Folder Example" ), Description( "Folder created in the scripting index example script.") );
// Make the result scriptable.
folder = jmpliveresult << As Scriptable;
// Get the folder ID.
id = folder << Get ID();
// Output the folder ID to the JMP log.
Write( "ID: ", id );

Publish to a Folder in a Space

To publish to an existing folder in a space, you need the folder ID. You can find the folder ID in JMP Live by clicking on a folder. The folder ID appears in the URL, or you can copy the ID under Details.

Examples of Publishing to a Folder in a Space

This example publishes a Graph Builder report to a folder in your personal space.

Names Default To Here( 1 );
// Open the Big Class data table.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// Run the Graph Builder table script and call the report gbsmoother.
gbsmoother = dt << Run Script( "Graph Builder Smoother Line" );
// Set up the connection to the JMP Live server.
liveconnection = New JMP Live();

/* Create a folder in your personal space and give it a title. Use the JMP Live Connection that you established and return a JMP Live object called jmpliveresult. */

jmpliveresult = liveconnection << Create Folder( Space( "~" ), Title( "Publish to Folder Example" ) );
// Make the result scriptable.
folder = jmpliveresult << As Scriptable;
// Add the gbsmoother report to content.
content = New JMP Live Content( gbsmoother );

/* Publish the content to your personal space. Use the JMP Live Connection that you established and return a JMP Live object called jmpliveresult. */

jmpliveresult = liveconnection << Publish( content, Folder( ID( folder << Get ID ) ) );
// Close all data tables without saving.
Close All( Data Tables, NoSave );

This example publishes a data table to a folder in your personal space.

Names Default To Here( 1 );
// Set up the connection to the JMP Live server.
liveconnection = New JMP Live();

/* Create a folder in your personal space and give it a title. Use the JMP Live Connection that you established and return a JMP Live object called jmpliveresult. */

jmpliveresult = liveconnection << Create Folder( Space( "~" ), Title( "Publish Standalone Data Example" ) );
// Make the result scriptable.
folder = jmpliveresult << As Scriptable;
// Add the data table Big Class to content.
content = New JMP Live Content( Data( "$SAMPLE_DATA/Big Class.jmp" ) );

/* Publish the content to your personal space. Use the JMP Live Connection that you established and return a JMP Live object called jmpliveresult. */

jmpliveresult = liveconnection << Publish( content, Folder( ID ( folder << Get ID ) ) );
// Close all data tables without saving.
Close All( Data Tables, NoSave );

This example publishes two Graph Builder reports to a folder in your personal space.

Names Default To Here( 1 );
// Open the Big Class data table.
bc = Open( "$SAMPLE_DATA/Big Class.jmp" );
/* Run two Graph Builder table scripts and call the reports gbsmoother and gbline. */
gbsmoother = bc << Run Script( "Graph Builder Smoother Line" );
gbline = bc << Run Script( "Graph Builder Line and Bar Charts" );
// Set up the connection to the JMP Live server.
liveconnection = New JMP Live();

/* Create a folder in your personal space with a title. Use the JMP Live Connection that you established and return a JMP Live object called jmpliveresult. */

jmpliveresult = liveconnection << Create Folder( Space( "~" ), Title( "Multiple Reports Example" ) );
// Make the result scriptable.
folder = jmpliveresult << As Scriptable;
// Add the gbsmoother report to content1.
content1 = New JMP Live Content( gbsmoother );
// Add the gbline report to content2.
content2 = New JMP Live Content( gbline );
// Publish content1 and content2 (in a list) to the newly created folder.
jmpliveresult = liveconnection << Publish( {content1, content2}, Folder( ID( folder << Get ID ) ) );
// Close all data tables in JMP without saving.
Close All( Data Tables, NoSave );
Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).