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
Chilly
Level I

Tabulate script to use all columns as grouping columns in Row Table

I am still fairly novice with JSL but I am looking to generate a table using all the columns in a file as grouping columns, where the script will select all the columns in the file vs. having identify each column name in the script.  Reason being is that the column names can change from split table to split table and I want a script that will be generic enough to handle this.  Here is an example of the script I am using now

 

// Open dialog box to select SWR Table
project << Run Script(
Files = Pick File( "Select SWR Table", "$DESKTOP", {"JMP Files|xlsx", "All Files|*"}, 1, 0, "", "multiple" );
For( i = 1, i <= N Items( Files ), i++,
Try(
Open(
Files[i],
Worksheet Settings( Has Column Headers( 1 ), Number of Rows in Headers( 1 ), Headers Start on Row( 1 ),
Data Starts on Row( 2 ) )
)
)
);
Bring Window To Front
);

//Create SWR Table - TBD
project << Run Script(
obj = Tabulate( Add Table( Row Table( Grouping Columns( :WAFER, :EPI Run ) ) ),Include missing for grouping columns(1) )
);

 

I want to substitue out the individual columns in "Grouping Columns" to use all the columns from the table without having to specify each one.  Is this possible?

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Tabulate script to use all columns as grouping columns in Row Table

I think this is what you want.  It should create a new tabulate table for each data table read in

// Open dialog box to select SWR Table
project << Run Script(
	Files = Pick File(
		"Select SWR Table",
		"$DESKTOP",
		{"JMP Files|xlsx", "All Files|*"},
		1,
		0,
		"",
		"multiple"
	);
	For( i = 1, i <= N Items( Files ), i++,
		Try(
			dt=Open(
				Files[i],
				Worksheet Settings(
					Has Column Headers( 1 ),
					Number of Rows in Headers( 1 ),
					Headers Start on Row( 1 ),
					Data Starts on Row( 2 )
				)
			)
		);
		dt << rerun formulas;
		colList = dt << get column names( nominal );
		obj = dt << Tabulate(
		Add Table( Row Table( Grouping Columns( evalexpr(colList) ) ) ),
		Include missing for grouping columns( 1 )
	)
	);
	Bring Window To Front;
);
//Create SWR Table - TBD
/*project << Run Script(
	obj = Tabulate(
		Add Table( Row Table( Grouping Columns( :WAFER, :EPI Run ) ) ),
		Include missing for grouping columns( 1 )
	)
);*/
Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: Tabulate script to use all columns as grouping columns in Row Table

I think this is what you want.  It should create a new tabulate table for each data table read in

// Open dialog box to select SWR Table
project << Run Script(
	Files = Pick File(
		"Select SWR Table",
		"$DESKTOP",
		{"JMP Files|xlsx", "All Files|*"},
		1,
		0,
		"",
		"multiple"
	);
	For( i = 1, i <= N Items( Files ), i++,
		Try(
			dt=Open(
				Files[i],
				Worksheet Settings(
					Has Column Headers( 1 ),
					Number of Rows in Headers( 1 ),
					Headers Start on Row( 1 ),
					Data Starts on Row( 2 )
				)
			)
		);
		dt << rerun formulas;
		colList = dt << get column names( nominal );
		obj = dt << Tabulate(
		Add Table( Row Table( Grouping Columns( evalexpr(colList) ) ) ),
		Include missing for grouping columns( 1 )
	)
	);
	Bring Window To Front;
);
//Create SWR Table - TBD
/*project << Run Script(
	obj = Tabulate(
		Add Table( Row Table( Grouping Columns( :WAFER, :EPI Run ) ) ),
		Include missing for grouping columns( 1 )
	)
);*/
Jim