If the data behind a JMP Live report changes, you can update the data (or map file, if applicable). Any reports that use the data are updated and automatically regenerate in JMP Live.
The following example creates a Distribution report, publishes the report and the associated data to a folder in your personal space, and updates the data.
This example publishes a Distribution report to a folder in your personal space, updating the existing data in JMP Live.
Names Default To Here( 1 );
// Open the Big Class sample data table.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// Run the Distribution table script and call the report dist.
dist = dt << Run Script( "Distribution" );
// Create a 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 Result object called jmpliveresult. */
jmpliveresult = liveconnection << Create Folder( Parent Folder( "~" ), Title( "Update Data Example" ), If Exists( "use" ) );
// Obtain the JMP Live Folder object from the result.
folder = jmpliveresult << As Scriptable;
// Create a content object containing the the Distribution report.
content = New JMP Live Content( dist, Title( "My Distribution Report" ) );
// Publish the content to the newly created folder.
jmpliveresult = liveconnection << Publish( content, Folder( folder ) );
// Obtain the list of published posts from the JMP Live Result object.
postlist = jmpliveresult << As Scriptable;
// Get the ID of the published data from the list of published posts.
dataId = "";
For( i = 1, i <= postlist << Get Number Of Items, i += 1,
type = postlist[i] << Get Type();
If( type == "Data",
dataId = postlist[i] << Get ID
);
);
// Use the Update Data command and the dataId to update the data table in JMP Live.
liveresult = liveconnection << Update Data( Data( dataId ), dt );