Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Apr 15, 2020 8:37 AM
| Last Modified: May 6, 2020 9:38 AM
JMP Live workflow: from data input to automated report publication.As a JMP Live admin, you are going to be asked by the producers in your organization how to publish reports automatically on a routine schedule without having to manually click “Run.” That's easy!
Trick #2: Automate Those Reports
Tell them all they need to do is use JSL (JMP Scripting Language) in conjunction with Windows Task Scheduler.
Doing so allows users to automatically publish reports that are updated with fresh sets of data without any manual intervention. Armed with JSL’s HTTP Request function, users can easily create the scripting needed to pull in fresh data from online databases via API requests (more information found in this blog post). HTTP Request can even be used with online databases (like Salesforce) that require OAuth 2.0 token authentication to access the data contained within.
Once the data is pulled into JMP, the user can easily manipulate the data table with the various object calls available in JSL. After using this data table to generate a Graph Builder report, save the script with the Save Script option found in the red triangle menu of the Graph Builder interface. The combination of the HTTP Requests (described above), data manipulation scripts, and Graph Builder scripts is all you need to successfully generate the up-to-date report you want – with just the click of a button.
Once you have the scripts necessary to generate the up-to-date report, the next step is scripting the publishing process to JMP Live. After adding the reports you wish to publish to a New Web Report() object, use the Publish() function to successfully script the publishing process. The Publish() function requires two forms of user information in order to run correctly: a username and an API Key. The API Key is obtained by going to your Profile in JMP Live and selecting "Edit", which will bring up a window with a "Generate API Key" button. Clicking this button will bring up another window where your API Key is displayed. Below is an sample script on how to publish given an API Key:
webreport = New Web Report();
webreport << Add Report( r1, Title(“Dashboard of Air Quality”) );
use_data = "true";
url = webreport << Publish( URL("JMP Live URL"), Username("your username"), API Key("your api key"),
Public(1), Publish Data(use_data)
If( !Is Empty( url ),
Web( url )
And now your script is complete! Use Windows Task Scheduler to set the schedule of when the report is run by following these steps to set up the task correctly:
Once Task Scheduler is open, select “Task Scheduler Library” in the menu on the left.
Select “Create Task…” in the menu on the right, which will open a new window where the task is created.
Make sure to name the task and then select “Run whether user is logged in or not.”
Go to the Actions menu and select “New,” which will open a new window called “New Action.”
Keep Action as “Start a program” and select “Browse.”
Find the location of the jmp.exe file for JMP 15 and select “Open” for that file.
In the New Action window, copy and paste the file location of the script you wish to automate to the “Add arguments (optional)” box. Make sure the file location is contained within quotation marks.
Select “OK” to save your changes.
Select “Triggers” in the Create Task window.
Select “New,” which will open a new window called New Trigger.
Use this menu to set the schedule for the script. Make sure that Enabled is checked before selecting “OK” to save your changes.
Select “OK” to save the task; enter your system username and password.
There are several important items to keep in mind while using Task Scheduler:
JMP 15 sessions will remain hanging even if the script is executed without any errors. It is extremely important to include a Quit("No Save") line at the end of your script to prevent this from occurring.
JMP 15 sessions will remain hanging if the script is executed and an error occurs. The best way to prevent this is to modify your script to be Try ( your script, Quit("No Save") ). Doing so will quit the JMP 15 session and prevent it from hanging if an error occurs.
When your system password changes, you must go to each task and re-enter your new system password, otherwise it will not run. After double-clicking the task and selecting “OK,” you will then be prompted to enter your system username and password.
A successfully scheduled task with some of the required settings visible.