- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Scripting to go to last row in table
Hi All,
I'm trying to set up a JSL script that will take the user to the last row(or any specific row) in the table upon opening. I have it working for standalone tables by using the On Open script property and the Go To Row() message. I have found, however, that this does not work when the table is procedurally generated from a script (i.e. from a standalone SQL query with custom formatting scripts).
I have tried both the Go To Row() and Select Rows() combined with Next/Previous Selected and neither have the expected effect. The targeted row gets selected, but the table does not scroll to show the selected row. I don't get any errors in the debugger log so I assume the line runs fine.
Is there a seperate trick to getting table messages to run in JMP13?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Scripting to go to last row in table
Try adding a wait statement. For example:
dt=Open("mypath\table.jmp");
wait(0);
dt<<go to row(nrow(dt));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Scripting to go to last row in table
Try adding a wait statement. For example:
dt=Open("mypath\table.jmp");
wait(0);
dt<<go to row(nrow(dt));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Scripting to go to last row in table
Thanks, that worked, but I'm confused as to why.
In terms of script time, the script as a whole takes ~4-6 seconds to run completely. The Go To Row command was at the end of the script and the table was generated in the beginning with multiple table messages that run succesfully in between. Do you know if JMP finishes each line/message before moving to the next? If so, then I don't see why the wait command did anything. Or is it just a quirk in JSL?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Scripting to go to last row in table
Sometimes JMP needs to finish a command before continuing to the next command so adding a wait statement allows it to finish the previous command.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Scripting to go to last row in table
No, JMP does not run your code synchronously. It begins each function as soon as possible, so you can have situations where the results from an earlier function are not available when a later function is called, which might depend on those results.
Wait( 0 ) causes JMP to 'catch up' before calling the next function after Wait().