For Columns and Objects like Reports, there exists a command
obj << Get Data Table();
to get a reference to the respective data table.
Is there a similar function for Table Scripts? something like
This Data Table()
some lazy implementations which could lead to issues:
- reference the data table by its name.
Data Table ("my table") << new column("test")
this works till there is a conflict with another data table with the same name and " 2" is added automatically to the table name. - use mydt = current data table() to generate a reference to the data table
This works fine if I run the script from the table itself. To have the chance to click on the play button, one has to select the data table. Therefore, it will be the current one. good.
But when I trigger the Table Script via dt << run sricpt ("myscript"), another data table could be the current one.
edit #1: @jthi's example below suggests, that this statement is not correct:
When you trigger a table script, the table with the table script gets the current data table.
so: no issues.
edit #2: ... but it seems that "gets the current data table" doesn't happen immediately.
so: under some circumstances there could be some issues (see below)