You could test this (along the lines I mentioned earlier):
NamesDefaultToHere(1);
// Function to determine if two tables are linked
rLinked = Function({dt1, dt2}, {Default Local},
dt1 << selectAllRows;
if(NRow(dt2 << getSelectedRows) > 0, linked = 1, linked = 0);
dt1 << clearSelect;
dt2 << clearSelect;
linked;
);
// Look at the open tables in the session and see which pairs are linked
linkedTables = Function({}, {Default Local},
nt = NTable();
linkMat = J(nt, nt, .);
tblNames = {};
for(t1=1, t1<=nt, t1++,
InsertInto(tblNames, DataTable(t1) << getName);
for(t2=t1+1, t2<=nt, t2++,
if(rLinked(DataTable(t1), DataTable(t2)), linkMat[t1, t2] = 1, linkMat[t1, t2] = 0);
);
);
EvalList({linkMat, tblNames});
);
// Make some active tables
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// Unlinked subset
dt << selectRandomly(0.1);
dt2 = dt << Subset(LinkToOriginalDataTable( 0 ) );
dt2 << setName("Unlinked");
// Linked subset
dt << selectRandomly(0.1);
dt3 = dt << Subset(LinkToOriginalDataTable( 1 ) );
dt3 << setName("Linked");
// Get the 'link matrix'
linkedOrNot = linkedTables();
dt4 = AsTable(linkedOrNot[1], << setName("Linked Tables"), << columnNames(linkedOrNot[2]));
dt4 << NewColumn("Column", Character, Values(linkedOrNot[2]));
dt4 << moveSelectedColumns({"Column"}, ToFirst);