Table Scripts and the Parent Data TableI have a set of scripts that I copy to new data tables. To make sure that when I run the table script it acts on the data table it belongs to I have to edit all of the scripts to point to the right data table (dt = Data Table("this one")). Is there a generic way to reference the parent data table, similar to dt = Current Data Table(), but more like dt = Parent Data Table()?

Re: Table Scripts and the Parent Data TableIn answer to my own question no, comments are not included when using a script to add a script to a data table, the comments are stripped out just like they are when you copy scripts from one table to another (why anyone would think this was a desirable default behavior is beyond me, if I take the time to add comments to a script why would I want to throw them away anytime I go to use that script somewhere else).Re: Table Scripts and the Parent Data TableI thought about that, and I may give it a try, but I've decided to just go with David's suggestion and run the scripts from the data table so the Current Table will be the one I want. If I run the script from the editor, I'll just have to be more careful. Question, when writing a script to create table scripts, can comments be included in the table scripts?Re: Table Scripts and the Parent Data TableThere is another, more complex way to approach this. Rather than doing a copy/paste for your table scripts, you could write a script that adds the various table scripts to the new table, and within that script, it could generate the code for each of the scripts that would point to the data table the scripts are in.
Re: Table Scripts and the Parent Data TableNot sure the Global namespace is the place for this in my workflow. I always have multiple tables open at anyone time, hence wanting to make sure that the scripts always work on the right data (but thanks for the heads up on scripting an OnOpen event, didn't know JMP did that). I could just use Current Data Table and always run from the green triangle as David suggested, but I prefer to be explicit in all references when possible. I was hoping that there was a way to do this, but I guess the connection is only one way. Data Tables know what table scripts they have, but table scripts don't know what table they belong to.Re: Table Scripts and the Parent Data TableThanks David, appreciate the help.Re: Table Scripts and the Parent Data TableJust make it a table script that sets a global variable value
Re: Table Scripts and the Parent Data TableTable variables don't groupRe: Table Scripts and the Parent Data Tablenot hidden, but you can group them, which takes all of the grouped scripts and places them in a expandable single label
Re: Table Scripts and the Parent Data TableThanks Jim. I could probably also handle it with a table variable. Can those be hidden? I already have quite a few, and I'd like to limit them.
Re: Table Scripts and the Parent Data TableOK I asumed you were just running it as a table script using the green triangle.
Re: Table Scripts and the Parent Data TableYou should be able to create an "OnOpen" table script that when you open the table, it creates a globle variable that contains the current data table that you are working on. Then in the subsequent scripts, you reference that global variable. Just moving from one table to another would not change that global variable. It would only change when another one of your taqbles that has an "OnOpen" table script that changes the global variable is opened.
Re: Table Scripts and the Parent Data TableIf the script is open for editing, running the script from the editor will grab whichever data table is current using dt = Current Data Table(). The only way to guarantee that the script will point at the right table is by being explicit about the table the script should act on (which is what JMP teaches in the Intro to Scripting class as a best practice), so I'm looking for a way to do that generically so I don't have to constantly update the scripts everytime the data table name changes.
In the attached photo, the table script belongs to Data Table("this one") and Data Table("that one") is the Current Data Table(). If "when you run the table script, the table that it is associated with is the current data table" then the result of the scipt should be "this one" not "that one"

Re: Table Scripts and the Parent Data TableAt the point when you run the table script, the table that it is associated with is the current data table so you should be able to use dt = CurrentDataTable().