Thanks @Craige_Hales. I understand the issue a bit better now. However there is still a glitch. The following works as intended
Names Default To Here (1);
delete symbols ();
clear log ();
// set up a table to accept the results
resultsdt = New Table( "Results Table",
Add Rows( 8),
New Column( "Column 1" ),
New Column( "Column 2" ),
New Column( "Column 3" ),
New Column( "Column 4" ),
New Column( "Column 5" ),
New Column( "Column 6" ),
New Column( "Min", Numeric ),
New Column( "Median", Numeric ),
New Column( "Max", Numeric ),
New Column( "SD", Numeric )
);
Column(resultsdt, "Column 1")[1] = "A";
Column(resultsdt, "Column 1")[2] = "B";
Column(resultsdt, "Column 1")[3] = "C";
Column(resultsdt, "Column 1")[4] = "D";
Column(resultsdt, "Column 1")[5] = "E";
Column(resultsdt, "Column 1")[6] = "F";
Column(resultsdt, "Column 1")[7] = "G";
Column(resultsdt, "Column 1")[8] ="H";
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
getDistChart = Function({ColName, _LSL, _USL}, {distChart},
New Window(""||ColName||" distribution",
distChart = 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" )} )}
)
)
);
);
return(distChart);
);
dist = getDistChart ("weight", 55, 185);
toPass= Report( dist )[Outline Box("weight" ), Outline Box( "Quantiles" ), Table Box( 1 ), Number Col Box(1)]<< get (1);
//resultsdt = include ("basicTable.jsl");
resultsdt[1, 2] = toPass;
//show (toPass);
However, if I define resultsdt separately as below
Names Default To Here (1);
// set up a table to accept the results
resultsdt = New Table( "Results Table",
Add Rows( 8),
New Column( "Column 1" ),
New Column( "Column 2" ),
New Column( "Column 3" ),
New Column( "Column 4" ),
New Column( "Column 5" ),
New Column( "Column 6" ),
New Column( "Min", Numeric ),
New Column( "Median", Numeric ),
New Column( "Max", Numeric ),
New Column( "SD", Numeric )
);
Column(resultsdt, "Column 1")[1] = "A";
Column(resultsdt, "Column 1")[2] = "B";
Column(resultsdt, "Column 1")[3] = "C";
Column(resultsdt, "Column 1")[4] = "D";
Column(resultsdt, "Column 1")[5] = "E";
Column(resultsdt, "Column 1")[6] = "F";
Column(resultsdt, "Column 1")[7] = "G";
Column(resultsdt, "Column 1")[8] ="H";
and then call it as below (which is how I have got my actual code set up)
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",
distChart = 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" )} )}
)
)
);
);
return(distChart);
);
dist = getDistChart ("weight", 55, 185);
toPass= Report( dist )[Outline Box("weight" ), Outline Box( "Quantiles" ), Table Box( 1 ), Number Col Box(1)]<< get (1);
resultsdt = include ("basicTable.jsl");
resultsdt[1, 2] = toPass;
//show (toPass);
I get the error
Not subscriptable value{8} in access or evaluation of 'Assign' , resultsdt[1, 2] = /*###*/toPass/*###*/
where am I going wrong?
(I note that if I do not define the entries in Column 1 at all, both above approaches work fine)
When it's too good to be true, it's neither