I am on JMP13 and I understand from here that I cannot have multiple outputs from a function unless I use lists. So I have put together the following script and it works as expected.
Names Default To Here (1);
delete symbols ();
clear log ();
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
getDistChart = Function({ColName, _LSL, _USL}, {distChart},
New Window(""||ColName||" distribution",
distChart1 = dt <<Distribution(
Stack( 1 ),
Automatic Recalc( 1 ),
Continuous Distribution(
Column( :weight ),
Horizontal Layout( 1 ),
Vertical( 0 )
),
Local Data Filter(
Close Outline( 1 ),
Add Filter( columns( :sex ), Where( :sex == "M" ) )
)
);
distChart2 = dt << Distribution(
Stack( 1 ),
Continuous Distribution(
Column(As Column (ColName) ),
Horizontal Layout( 1 ),
Vertical( 0 ),
Capability Analysis( LSL(_LSL ), USL(_USL) )
),
SendToReport(
Dispatch(
{},
"Distrib Histogram",
FrameBox,
{DispatchSeg( LabelSeg( 1 ), {Font( "Segoe UI", 7, "Plain" )} ),
DispatchSeg( LabelSeg( 2 ), {Font( "Segoe UI", 7, "Plain" )} )}
)
)
);
);
op = {distChart1, distChart2};
return (op);
);
dist = getDistChart ("weight", 55, 185);
dist1 = dist [1];
dist2 = dist [2];
toPass= Report(dist1)[Outline Box("weight" ), Outline Box( "Summary Statistics" ), Table Box( 1 ), Number Col Box(1)]<< get (1);
However, the following does not work
toPass= Report(dist[1])[Outline Box("weight" ), Outline Box( "Summary Statistics" ), Table Box( 1 ), Number Col Box(1)]<< get (1);
and I am wondering if I am making a mistake in the syntax for using an argument in Report()?
When it's too good to be true, it's neither