cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Ake
Ake
Level IV

What is the best way to rename a data table without ruining saved scripts?

When I write reports I embed the data table into the word document in a zip-file, so that future readers can extract the data. When I am about to do that I often realize the the name of the data table was chosen hastily, so I want to give it a better name before saving into the report.

 

The problem I run into is that some (not all) of the scripts I have saved along the way contains the name of the data table., with the result that hose scripts stop working.

 

Is there a way to rename the data table without running into this problem?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Byron_JMP
Staff

Re: What is the best way to rename a data table without ruining saved scripts?

If you want to be super robust about your scripts saved to a data table, you could add a little JSL:

 

//something like this
dt=current data table(); dt<< Distribution(Continuous Distribution( Column( :Protein ) ));

If you're not working with scripts saved to a data table. It is often a very good idea to replace the explicit data table names with a variable so that if the table name changes (e.g. gets appended to) then the script will work.

 

 

Data table("emanon")  is an explicit table name.

dt=open("emanon.JMP"); is a reference to the table name.  When dt is evaluated it is: data table("emanon"), but in all your scripts it's just dt.  

 

 

//original script

Data Table( "trends.jmp" ) << Stack(
	columns( :Protein, :Purity ),
	Drop All Other Columns( 1 ),
	Output Table( "Stack of trends (Protein etc.)" )
);

//edit to variable references

dt=current datatable(); //or some other way to reference the table you're acting on
dt1=dt<< Stack( columns( :Protein, :Purity ), Drop All Other Columns( 1 ), Output Table( "Stack of trends (Protein etc.)" ) );

although the table name is "Stack of trends (Protein etc.)" the reference for the new table is dt1, which has the added bonus of being much easier to type than the entire table name (that I would misspell and break the script).

 

 

JMP Systems Engineer, Health and Life Sciences (Pharma)

View solution in original post

2 REPLIES 2
Byron_JMP
Staff

Re: What is the best way to rename a data table without ruining saved scripts?

If you want to be super robust about your scripts saved to a data table, you could add a little JSL:

 

//something like this
dt=current data table(); dt<< Distribution(Continuous Distribution( Column( :Protein ) ));

If you're not working with scripts saved to a data table. It is often a very good idea to replace the explicit data table names with a variable so that if the table name changes (e.g. gets appended to) then the script will work.

 

 

Data table("emanon")  is an explicit table name.

dt=open("emanon.JMP"); is a reference to the table name.  When dt is evaluated it is: data table("emanon"), but in all your scripts it's just dt.  

 

 

//original script

Data Table( "trends.jmp" ) << Stack(
	columns( :Protein, :Purity ),
	Drop All Other Columns( 1 ),
	Output Table( "Stack of trends (Protein etc.)" )
);

//edit to variable references

dt=current datatable(); //or some other way to reference the table you're acting on
dt1=dt<< Stack( columns( :Protein, :Purity ), Drop All Other Columns( 1 ), Output Table( "Stack of trends (Protein etc.)" ) );

although the table name is "Stack of trends (Protein etc.)" the reference for the new table is dt1, which has the added bonus of being much easier to type than the entire table name (that I would misspell and break the script).

 

 

JMP Systems Engineer, Health and Life Sciences (Pharma)
Ake
Ake
Level IV

Re: What is the best way to rename a data table without ruining saved scripts?

Thanks for the tip, Byron_JMP! I realize that would fix it. The challenge is my laziness saving a lot of code that is generated from the graphs etc, some of which include the name of the data file. Since I work fast and sloppy, I resave many times. I guess I would have to look through my scripts when finished to see which ones include the file name. This is for data that I study for specific experiments. For data that I use long-term, and possibly share, I think your suggested solution is what I should use.

 

Would be nice if a script could change the table names in the scripts, or possibly interpret the table names differently. Haven't thought that through, though. Might end up creating other problems..

Recommended Articles