What is the most reliable way of updating table script?
Let's say I have a script that saves a snippet of a script into a table as table script and gives it a name "Script". Let's say, I run that script again and it again saves an updated snippet as table script - it will add " 2" to "Script" since that name already exists.
If I then want to run the script by name it will run the old one, with name "Script", when I really wanted to run the most recent, "Script 2".
And since I run the main script many times, it creates many versions of the "Script", when I just really want to keep updating it.
So far the most reliable option is to try to delete script with that name first before updating it:
try(dt << Delete Scripts( "Script" ));
dt << New Table Script( "Script", Show("Test"));
Also, Is there a way to get a pointer to table script and use it?
Something like:
script = dt << Get Table Script("Script");
script << Run Script();
or even get a pointer to the script when creating it (I checked, looks like it doesn't work, New Script message doesn't return anything)
script = dt << New Script("Script", Show("Test"));
script << Run Script();