cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
DMR
DMR
Level V

Scrolling a Table Box to display a specific row

Hi - I have a Table Box which contains a few thousand rows, so only the first few of those rows are directly visible within the window that contains it: to see the rest I need to scroll the Table Box with the vertical scroll bar.  Somewhere within that Table Box is a row that satisfies a particular criterion.  A simple script will tell me what that row number is, and the Set Selected Rows() property will highlight it for me, so I could easily scroll down the table to that row to find it - but I'd prefer to have the Table Box automatically scrolled to the right point so that the row is displayed for me.

Is there a way to script that?  I can't see a property listed by the "Show Properties" command that looks as if it might perform such a function.

Many thanks

6 REPLIES 6

Re: Scrolling a Table Box to display a specific row

Hi dqr2,

Are you graphing your data?  If so, one thing you can do is to highlight a data point or set of points in the graph that are of interest.  Navigate back to your data table and hit the F7 key.  Typing F7 will take you to the row in the table for the data point that is first in the list of the selected points.  You can then hit F7 again to take you to the next point.  Hit F6 to take you back to a previous point.

Best,

Bill

DMR
DMR
Level V

Re: Scrolling a Table Box to display a specific row

Hi Bill,

I'm afraid not; this is something that I need to be able to do with a JSL script, because I'm trying to remove the need for any action on the part of the user while some other tasks are being run.  If for example my script has already determined that the row the user needs to see is row 12345, but only the first 20 rows of the Table Box can be seen on the screen, then essentially what I need to be able to do here is send a message to the Table Box saying "scroll down to row 12345, so that row is displayed within the window".

One alternative way to do it would be simply to extract the contents of row 12345 and display it separately, but I'd prefer to scroll the display down to the relevant row because there's other information contained within the table around that position that's also likely to be of interest to the user.

It may be that I can't actually do this, in which case I'll find another other way out - but I felt it was worth asking first.

Many thanks

txnelson
Super User

Re: Scrolling a Table Box to display a specific row

I am not aware of any messages that can be sent to a table box to have it scroll to a specific location.  I have put in such a request to Support@jmp.com, but I have not seen anything as of yet.



I hope there is someone out there that can prove me wrong

Jim
cjackso21
Level I

Re: Scrolling a Table Box to display a specific row

Hello, I have been using F7 for years to highlight the next row and now it is not working.  Any idea why or how I can fix this?

Thanks,

Carol

 

cjackso21
Level I

Re: Scrolling a Table Box to display a specific row

Sorry, just realized it is my wireless keyboard.  When I do it on my computer keyboard it works.  

 

nikles
Level VI

Re: Scrolling a Table Box to display a specific row

Hi.  I recently had the same question and reached out to JMP support (credit to Jasean).  Their solution is shown below, and I just wanted to share in case anyone else encounters this.  Basically: you can't control scroll position in a TableBox, but you can with a VScrollBox.  So, turn off scrolling in the TableBox, and enclose the table box in a VScrollBox instead.

 

Names Default to Here(1);

long_lis = {};
for each({i}, 1::100, InsertInto(long_lis, "Item " || Char(i)));

scb = StringColBox("Long List", long_lis);
tbl = TableBox(scb);
tbl << Set Scrollable(0, 0);            //Turning off scrolling in the tbl box
tbl << Set Selectable Rows;

goto_bb = ButtonBox("Go To Item",
    toSelect = neb << Get;
    ItemCount = NItems(long_lis);
    tbl << Set Selected Rows(EvalList({toSelect})); // select desired item
    
    {h_extent, v_extent} = vsb << Get Scroll Extents; // in pixels
    // determine portion of list above selected item and scroll to that relative position
    portion = toSelect / ItemCount;
    if(portion < 0.05, portion = 0);
    vsb << Set Scroll Position(0, portion * v_extent); // in pixels
);

winny = NewWindow("test",
    goto_bb, neb = Number Edit Box(50),
    vsb = VScrollBox(Size(360), tbl) // set the size as number of pixels
);

 

I agree it's not as clean as having the control built-in directly to TableBox, but it works.  Hope this helps.

-nikles