Subscribe Bookmark RSS Feed

How to rename the default graph builder script in a data table ?

AJ

New Contributor

Joined:

Jan 16, 2017

Below code generates a script for graph builder and is saved under the data table.

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
obj = Graph Builder(
	Variables( X( :Sex ), Y( :Height ), Group X( :Age ) ),
	Elements( Box Plot( X, Y ) )
);
obj << Save Script to Data Table;

The names of the graph builder objects are using the default naming pattern for this platform. How do I rename them to my choice? (I have attached a screen shot and the graph builder names are highlighted in yellow)

I have tried using "set name" before and after saving the script to the data table but it didn't work. 

Thanks in advance!

AJ

2 ACCEPTED SOLUTIONS

Accepted Solutions
David_Burnham

Super User

Joined:

Jul 13, 2011

Solution

It looks like the ability to add the name as an argument is a version 13 feature.

Here is a workaround:

obj << Save Script To Data Table;
lstNames = dt << Get Table Script Names;
dt << Rename Table Script( lstNames[NItems(lstNames)], "My Script" );
-Dave
AJ

New Contributor

Joined:

Jan 16, 2017

Solution
Thanks a lot for your effort! This works perfect for me.
4 REPLIES
David_Burnham

Super User

Joined:

Jul 13, 2011

Here's a couple of approaches.

 

First method, based directly on your code.  Just add an argument to the message:

 

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
obj = Graph Builder(
	Variables( X( :Sex ), Y( :Height ), Group X( :Age ) ),
	Elements( Box Plot( X, Y ) )
);
obj << Save Script to Data Table("My Script");

The second method, if you simply want to attacth the script with a name, but not execute it:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Set Property("My Script,",	
	Graph Builder(
		Variables( X( :Sex ), Y( :Height ), Group X( :Age ) ),
		Elements( Box Plot( X, Y ) )
	);	
);
-Dave
AJ

New Contributor

Joined:

Jan 16, 2017

Dave, 

  Thanks for your response. I need to execute the script generated from graph builder and hence I tried  option 1.

obj << Save Script to Data Table("My Script");

Unfortunately, it still saves the script by the name "Graph builder" and not "My script".  For your information, I am using JMP 12. 

David_Burnham

Super User

Joined:

Jul 13, 2011

Solution

It looks like the ability to add the name as an argument is a version 13 feature.

Here is a workaround:

obj << Save Script To Data Table;
lstNames = dt << Get Table Script Names;
dt << Rename Table Script( lstNames[NItems(lstNames)], "My Script" );
-Dave
AJ

New Contributor

Joined:

Jan 16, 2017

Solution
Thanks a lot for your effort! This works perfect for me.