cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
JDA
JDA
Level II

Create a report window of graphs without spawning multiple graph windows

Hello, 

 

I have a datatable with hundreds of thousands of lines.  There is a run ID column, a column of device names (29 currently of interest), and a column of associated values.  So for each run there are multiple devices recording data, and I want to create run charts for each device with the run ID as the x-axis.  However, I have two issues that I can partially resolve individually, but not resolve together.  

 

First, I am using JMP 13.  I do have access to JMP 16 but not currently installed.  I have a whole bunch of existing scripts that I don't want to break by changing to another version of JMP, and what I am looking to do should be easy to do.  

 

Secondly, the general approach I am trying to take is the following: 

 

  1. Loop through list of unique device names and generate a run chart; feed into each individual run chart control and spec limits which have been determined from the data for each device (I can feed in the control and spec limits into the control charts easily enough)
  2. Aggregate all chart into a new window

 

The script I have for graphing is as follows: 

 

curDev = devices[i]
dt << Control Chart( Sample Label( :ID ), KSigma( 3 ), Where( :DeviceName == curDev ), Chart Col( Value, Levey Jennings(Avg(lims[4]), LCL(lims[3]), UCL(lims[5]) ) ), // lims list found separately SendToReport( Dispatch( {"Levey Jennings of Value"}, curDev, TextEditBox, {Set Text( curDev )} // Ensures y-axis title is device name rather than column name of "Value" ) ) );

This creates multiple graph windows, each with a box at the top which says "Where Device == curDev".  

So graphs can be plotted, albeit with an unnecessary and ugly box, but I get 29 graph windows open. 

 

So now I need to aggregate them all in a window and remove the top "Where Device ==" box.  

 

There's this reply on the forums which I thought would be helpful: how to remove "Where" from graph builder report window - JMP User Community.  Indeed, it does remove the box at the top if I spawn 29 individual graphs, thusly: 

 

Build_Chart = Function({var},
	cco = dt << Control Chart(
		Sample Label( :ID ),
		KSigma( 3 ),
		Where( :Value == curDev ),
		Chart Col( :Value, Levey Jennings(Avg(lims[4]), LCL(lims[3]), UCL(lims[5]) ) ),
	);
	tp = Report(cco) << topparent;
	tp[Textbox(1)] << delete;
);

for(i=1, i<=NItems(devices), i++,
	curDev = devices[i]; //probably unnecessary
	Build_Chart(curDev);
)

However, when I try to do the same thing as described in the linked forum post, I get 1 chart in the window and then the script errors out with "Send Expects Scriptable Object{75240} in access or evaluation of 'Send' , tp[Text Box( 1 )] << delete/*###*/"

 

Build_Chart = Function({var},
// same function as above
 )

pb = Panel Box();
for (i = 1, i<= NItems(devices), i++,
	curDev = devices[i];
	pb <<Append(Report(Build_Chart(curDev)));
);

Why does appending the chart to a panel box screw around with the tp << delete in the Build_Chart function?  

 

Another approach I have tried is something like the following, where I get a report object: 

 

nw = New Window("Charts",
	lub = Lineup Box(NCol(2));
);

for (i = 1, i<= NItems(devices), i++,
	curDev = devices[i];
	
	cco = dtRecLog << Control Chart(
			Sample Label( :ID ),
			KSigma( 3 ),
			Where( :Device == curDev ),
			Chart Col( :Value, Levey Jennings(Avg(lims[4]), LCL(lims[3]), UCL(lims[5]) ) ),
			
		);
		rep = cco << Report;
		lub << Append(rep);
);

This creates the separate window with 29 graphs without the "Where == " box, but it also spawns 29 separate graph windows.  cco << Delete Window doesn't work, as cco is the not a reference to a window.  I could do a Window(<window name>) << Delete Window, but I don't know what the window names are, and obvious guesses are not working, so I can't delete the windows in JSL.  

 

So, what I need help with is the following: 

 

  1. Create a window with all graphs without "Where :Device == curDev" box above the chart window
  2. Aggregate all charts into a single window
  3. Not spawn 29 different windows.  

 

Many thanks in advance for your help. 

 

1 REPLY 1
txnelson
Super User

Re: Create a report window of graphs without spawning multiple graph windows

I believe that you can move to your solution by using the Invisible option on your Control Chart, and then to append the report to an independent journal window.  Below is a modification of your code illustrating an approach to do this.  I have not been able to test the script, not having a sample data table, but I believe you will be able to see my approach, which I know will work.

Build_Chart = Function({var},
	cco = dt << Control Chart(invisible,
		Sample Label( :ID ),
		KSigma( 3 ),
		Where( :Value == curDev ),
		Chart Col( :Value, Levey Jennings(Avg(lims[4]), LCL(lims[3]), UCL(lims[5]) ) ),
	);
	tp = Report(cco) << topparent;
	tp[Textbox(1)] << delete;
);

NW = New Window("Results",<<journal, lub=lineupbox(ncol(2)));

for(i=1, i<=NItems(devices), i++,
	curDev = devices[i]; //probably unnecessary
	Build_Chart(curDev);
	lub << append(tp);
);
Jim