Above I was careful to say 'adapt this approach' :). Without speaking for others, when posting JSL snippets my intention is (usually) to encourage someone to figure out the code and then be able to go further for themselves.
If you change sigma to 2, you will have seen that there are only blue cells in the table (outliers on the low side), and the code isn't general enough to handle this and generates the error you saw.
Please find a more complete (untested . . . ) script that should cover all situations:
NamesDefaultToHere(1);
// Sample data
dt = Open("$SAMPLE_DATA/Big Class.jmp");
// Explore outliers
eo = dt << Explore Outliers(Y( :height ));
eo << Robust Fit Outliers( K Sigma( 2 ), Huber( 0 ), Quartile( 1 ) );
eo << obj << Color Cells( :height ); // Blue (red) cells are 'low' ('high')
// Get the column script
colScript = :height << getScript;
// Initialise lists (which may or may not be updated by the subsequent code)
redRowList = {};
blueRowList = {};
// Find the location of the sub-expression 'Color Cells'. if there are no outliers, 'colorCellsExist' will be 0
subExpr = {};
for(i=1, i<=NArg(colScript), i++, InsertInto(subExpr, Head(Arg(colScript, i))));
colorCellsExist = Contains(subExpr, Expr(Color Cells));
// Find the row numbwrs of any high (red) cells or low (blue) cells (red is '35', blue is '37'):
// Need to handle situations in which there are only high outliers, only low outliers, both high and low
// outliers, or no outliers
if(
colorCellsExist,
// Get the 'Color Cells' expression in the column script
cs = Arg(colScript, colorCellsExist);
if(
// If 'cs' is a list of lists, we have both high and low outliers . . .
IsList(Arg(cs, 1)[1]),
for(i=1, i<=NItems(Arg(cs, 1)), i++,
if(
(Arg(cs, 1)[i])[1] == 35, redRowList = (Arg(cs, 1)[i])[2];
(Arg(cs, 1)[i])[1] == 37, blueRowList = (Arg(cs, 1)[i])[2];
);
);
,
// . . . or if 'cs' is not a list of lists, we have either high or low outliers (but not both)
if(
Arg(cs, 1)[1] == 35, redRowList = Arg(cs, 1)[2],
Arg(cs, 1)[1] == 37, blueRowList = Arg(cs, 1)[2]
);
);
);
Print("High: "||Char(redRowList)||" Low: "||Char(blueRowList));