cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
zjuv007
Level III

How do I script Tabulating a document and then saving that Tabulated data into a Data table on my hard drive?

I would like to tabulate some data from document 'Data1', make this tabulated data into a new data table, and then save the new data as document 'Data2', here is my first high level stab at this and doesn't seem to work, any quick guidance?

 

dt = Open( "Data1.jmp", invisible );
(Data Table( "Data1" ) << tab = dt << Tabulate(
	Add Table(
		Column Table( Grouping Columns( :Code LLT ) ),
		Row Table( Grouping Columns( :CodeTypePrmaryAndDesc 3, :CodeTypePrmaryAndDesc 4 ) )
	)
));
dt_tab << Make Into Data Table
dt_tab << set name( "Tabulate" );

dt_tab << Save( "Data2.jmp" );
2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: How do I script Tabulating a document and then saving that Tabulated data into a Data table on my hard drive?

Below is a working version modification of your code.  Given the issues in your original code, I suggest that you spend some time reading the JSL documentation:

     Help==>Books==>Scripting Guide

Also, in the code below, in your Save() function, you do not specify a path to where you want to save the data.  You may need to specify a fully qualified path, in order to be able to save the table

dt = Open( "Data1.jmp", invisible );
tab = dt << Tabulate(
	Add Table(
		Column Table( Grouping Columns( :Code LLT ) ),
		Row Table( Grouping Columns( :CodeTypePrmaryAndDesc 3, :CodeTypePrmaryAndDesc 4 ) )
	)
);
dt_tab = tab << Make Into Data Table;
dt_tab << set name( "Tabulate" );
dt_tab << Save( "Data2.jmp" );
Jim

View solution in original post

zjuv007
Level III

Re: How do I script Tabulating a document and then saving that Tabulated data into a Data table on my hard drive?

@txnelson I am still not seeing a data2.jmp created with the script below:

 

dt = Open( "C:\Users\juvelj1\Desktop\Data 2014-2019\Products_2014.jmp", invisible );
tab = dt << Tabulate(
	Add Table(
		Column Table( Grouping Columns( :Code LLT ) ),
		Row Table( Grouping Columns( :CodeTypePrmaryAndDesc 3, :CodeTypePrmaryAndDesc 4 ) )
	)
);
dt_tab = tab << Make Into Data Table;
dt_tab << set name( "Tabulate" );
dt_tab << Save( "C:\Users\juvelj1\Desktop\Data 2014-2019\Data2.jmp" );

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: How do I script Tabulating a document and then saving that Tabulated data into a Data table on my hard drive?

Below is a working version modification of your code.  Given the issues in your original code, I suggest that you spend some time reading the JSL documentation:

     Help==>Books==>Scripting Guide

Also, in the code below, in your Save() function, you do not specify a path to where you want to save the data.  You may need to specify a fully qualified path, in order to be able to save the table

dt = Open( "Data1.jmp", invisible );
tab = dt << Tabulate(
	Add Table(
		Column Table( Grouping Columns( :Code LLT ) ),
		Row Table( Grouping Columns( :CodeTypePrmaryAndDesc 3, :CodeTypePrmaryAndDesc 4 ) )
	)
);
dt_tab = tab << Make Into Data Table;
dt_tab << set name( "Tabulate" );
dt_tab << Save( "Data2.jmp" );
Jim
zjuv007
Level III

Re: How do I script Tabulating a document and then saving that Tabulated data into a Data table on my hard drive?

@txnelson I am still not seeing a data2.jmp created with the script below:

 

dt = Open( "C:\Users\juvelj1\Desktop\Data 2014-2019\Products_2014.jmp", invisible );
tab = dt << Tabulate(
	Add Table(
		Column Table( Grouping Columns( :Code LLT ) ),
		Row Table( Grouping Columns( :CodeTypePrmaryAndDesc 3, :CodeTypePrmaryAndDesc 4 ) )
	)
);
dt_tab = tab << Make Into Data Table;
dt_tab << set name( "Tabulate" );
dt_tab << Save( "C:\Users\juvelj1\Desktop\Data 2014-2019\Data2.jmp" );
txnelson
Super User

Re: How do I script Tabulating a document and then saving that Tabulated data into a Data table on my hard drive?

What messages are in your JMP Log?

Jim
zjuv007
Level III

Re: How do I script Tabulating a document and then saving that Tabulated data into a Data table on my hard drive?

Clearing up my JMP code has resolved this issue and your modified code has worked.

Thanks Jim!