## Referencing TableBox columns by their position within the TableBox

This one is related to the recent thread of mine about identifying the type of display box within a Table Box, but it's essentially a different question so I thought I'd better start a new one for it.  If I have a TableBox containing several NumberColBoxes and StringColBoxes in no prespecified order, how can I reference each one purely by its position within the TableBox?

For example, to get at the third column in a TableBox called "MyTableBox" I'm assuming I would need something like MyTableBox[3], MyTableBox << child(3), (MyTableBox << child())[3] or whatever; however I've tried as many constructions like this as I can think of without success.  I can't use MyTableBox[StringColBox(3)] or something like that because I can't be certain that it is the third StringColbox.

The answer to this is almost certainly obvious, and yet I can't hit on the correct syntax.  What is it please?

1 ACCEPTED SOLUTION

Accepted Solutions

Super User

Joined:

Jun 23, 2011

Solution

The MyTableBox[3] construct should work. Default table boxes in JMP platform reports can contain hidden colboxes that also counts. So MyTableBox[3]<<select selects the third colbox but it may appear to select the second if there is a hidden/empty colbox in between.

Example:

Open( "\$SAMPLE_DATA/Big Class.jmp" )

<<Bivariate( Y( :weight ), X( :height ), Fit Line(), );

r = Current Report();

for(k=1, k<=5, k++,

for(i=1,i<=11,i++,

r[Table Box( 4 )][i] << select;

wait(0.1);

r[Table Box( 4 )][i] << deselect;

);

r[Table Box( 4 )][6+k]<<unhide

);

2 REPLIES

Super User

Joined:

Jun 23, 2011

Solution

The MyTableBox[3] construct should work. Default table boxes in JMP platform reports can contain hidden colboxes that also counts. So MyTableBox[3]<<select selects the third colbox but it may appear to select the second if there is a hidden/empty colbox in between.

Example:

Open( "\$SAMPLE_DATA/Big Class.jmp" )

<<Bivariate( Y( :weight ), X( :height ), Fit Line(), );

r = Current Report();

for(k=1, k<=5, k++,

for(i=1,i<=11,i++,

r[Table Box( 4 )][i] << select;

wait(0.1);

r[Table Box( 4 )][i] << deselect;

);

r[Table Box( 4 )][6+k]<<unhide

);

I must be going mad.  I've just tried that construction myself again and it works perfectly; unfortunately I didn't keep copies of my earlier attempts so I can't revisit whatever I was doing wrong the first time around.

Many thanks, and my apologies for not persisting!