A lot of the work that we do with JSL is modifying or extracting pieces from generated JMP Reports. Sometimes, however we need to go backwards from a Report and work with the underlying analysis itself. This actually involves moving between the different "layers" of a JMP Report - the Report Layer, and the Analysis Layer. This is easily done when you can start at the Analysis Layer and assign a variable to it. This recipe covers how to do the reverse - start at the Report Layer and access to the Analysis Layer that generated the report.
Ingredients:
- Report Objects
- Platform Objects
Sample Data Tables — Big Class.jmp
Difficulty — Medium
Video Time — 4:42
Steps:
- Open the Big Class.jmp sample data set and run the Distribution table script to follow along.
// Open Big Class and run the distribution report
dt = Open("$Sample_Data/Big Class.jmp");
dt << Run Script("Distribution");
- Get a reference to the window. This will give you access to the report layer.
// Get the window reference
reportName = "Big Class - Distribution";
reportReference = Get Window(reportName);
- Subscript into the first outline box (the one with the report level red triangle menu).
// Subscript into the first outline box
reportOB = reportReference[OutlineBox(1)];
- Send the Get Scriptable Object message to the outline box.
// Get the associated analysis layer object
analysisReference = reportOB << Get Scriptable Object;
- Check that we have accessed the Analysis Layer Object.
// Check that we've accessed the analyis layer object
// by displaying the script for the report
// (i.e. the result of Save Script To...)
reportScript = Char(analysisReference << Get Script);
Show( reportScript );
This can be done in one step:
// this could also all be done in one step
analysisReference = Get Window( "Big Class - Distribution" )[Outline Box( 1 )] << Get Scriptable Object;
// check the connection
reportScript = Char( analysisReference << Get Script );
Show( reportScript );