cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
hogi
Level XI

run table script

What is the difference between running a Table Script via the green Play icon:

hogi_0-1715787025984.png

 

... and via the Run button?

hogi_1-1715787065873.png

 

11 REPLIES 11
jthi
Super User

Re: run table script

Is there are reason to suspect that there is a difference? From the script "window" you can for example run separate parts by highlighting them.

-Jarmo
hogi
Level XI

Re: run table script

After inventing the 3rd  "solutions" to a "timing issue" in a table script - unfortunately without real success

... I found out that the actual difference was:

  1. run the script via the play icon → issue
  2. open the script window - [try some new code ... or nothing] - and click on the Run button → no issue.

 

 

 

Byron_JMP
Staff

Re: run table script

They generally do the same thing.

The little green arrow is faster, one click.

: )

JMP Systems Engineer, Health and Life Sciences (Pharma)
hogi
Level XI

Re: run table script

I thought so too ...

txnelson
Super User

Re: run table script

Running by clicking on the Green Run Arrow, runs the script on the data table it is attached to.

 

Running the script from the Edit window, runs the script on the Currently Active Data Table, which may not be the data table the script was saved to.

Jim
hogi
Level XI

Re: run table script

Good idea, 
but actually, for "Edit" mode I paid attention to have "my table" active before clicking on run.

And: it is the "Edit" mode which works

maybe it's related to a current data table() somewhere in the code - which might act differently if the script is started via the play icon - or via the Run button.

just putting a current data table() directly into a table script did not show a difference between the two approaches.

 

But my code is a lengthy chain of JSL, Main Menu (" ... "), open file, join, concatenate ...

I will try to reduce the complexity to show the difference - or to generate an anonymized example ...

txnelson
Super User

Re: run table script

I tried adding 

current data table();

to see if it would point the script back to the data table the script was saved on, and it did not.  The script ran against whatever data table the current data table was.

Jim
jthi
Super User

Re: run table script

Current Data Table() cannot be relied on in either of those cases. If new table opens immediately after you press green triangle, the current table can change before script is executed (most likely not that likely to happen with green run button but it could). Fairly easy to test with script like this

 

wait(1);
Caption(Current Data Table() << get name);

Run the script by pressing green triangle and immediately press Ctrl+N to create new table.

 

 

It does seem though that if you leave Current Data Table() out it will trigger on the table which script was run from (in both cases)

wait(1);
Current Data Table() << New Column("A");

vs

 

wait(1);
New Column("A");

 

 

-Jarmo
hogi
Level XI

Re: run table script


@jthi wrote:

It does seem though that if you leave Current Data Table() out it will trigger on the table which script was run from (in both cases)


Yes, looks "frightening" - but seems to be robust.
You can even trigger the table script with another table in the foreground - e.g. via dt << run script("name")--
no change: A table scripts always starts with "thisDataTable" as currentDataTable:

ThisDataTable() ?