cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
mmeewes
Level II

Summary Table Script Help

I’m hoping someone can help me debug some script. I’m working out of a base data table that has a row for every injury since 2016. I want to construct a C chart for our safety coordinator so that he can better analyze our injury trends. When I try to create this chart in the base data table, I get multiple values along the X axis that represent the same month. Because of this, every data point shows up as a 1 on the control chart. To overcome this issue, I created a summary table of the sum of the column “Count” grouped by “Month / Year” and sub grouped by the column “Recordable.”

 

When I create this table the C chart looks correct because there is only 1 row per month and a summary statistic for each type of injury. My issue is that I would really like to not have to go through this process every time I want to look at updated data. So I saved the script from my summary table and pasted it to the base table so that theoretically I should only have to click one button and viola, there is my summary table with the saved C charts. The issue is however that the column “Month / Year” in the base table is a formulated column that uses the column “Date” in the base table. For some reason when I run the script, JMP doesn’t know to reference the “Date” column correctly to write the formula for “Month / Year” resulting in blank values for that column.

 

I’m pretty new to writing script so anything you can do to offer some support would be extremely helpful. Oh and if there is a way to show the C charts on the base table that would then allow me to skip the summary table all together please let me know.

1 ACCEPTED SOLUTION

Accepted Solutions
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Summary Table Script Help

When copying the table script for a summary table you actually want to copy the 'source' script that is automatically attached to the new data table. That script is usually pretty short and does not have New Column syntax in it (if you added new columns after the tabe was created you would first run the source script and then add the new columns). Try opening your data table and running this:

 

dt = current data table();

//Summary Table
dtSum = dt << Summary(
	Group( :Month Year ),
	Sum( :Count ),
	Subgroup( :Recordable ),
	Freq( "None" ),
	Weight( "None" ),
	output table name( "Sum of Count by Month" )
);

//Chart
dtSum << Control Chart(
	Sample Label( :Month Year ),
	Sample Size( 250 ),
	KSigma( 3 ),
	Chart Col( :Name( "Sum(Count, Near Miss)" ), C ),
	Chart Col( :Name( "Sum(Count, Non-Record)" ), C ),
	Chart Col( :Name( "Sum(Count, Recordable)" ), C ),
	SendToReport(
		Dispatch(
			{"C of Sum(Count, Near Miss)"},
			"Attributes Chart",
			FrameBox( 2 ),
			{Frame Size( 64, 208 )}
		)
	)
);

View solution in original post

2 REPLIES 2
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Summary Table Script Help

When copying the table script for a summary table you actually want to copy the 'source' script that is automatically attached to the new data table. That script is usually pretty short and does not have New Column syntax in it (if you added new columns after the tabe was created you would first run the source script and then add the new columns). Try opening your data table and running this:

 

dt = current data table();

//Summary Table
dtSum = dt << Summary(
	Group( :Month Year ),
	Sum( :Count ),
	Subgroup( :Recordable ),
	Freq( "None" ),
	Weight( "None" ),
	output table name( "Sum of Count by Month" )
);

//Chart
dtSum << Control Chart(
	Sample Label( :Month Year ),
	Sample Size( 250 ),
	KSigma( 3 ),
	Chart Col( :Name( "Sum(Count, Near Miss)" ), C ),
	Chart Col( :Name( "Sum(Count, Non-Record)" ), C ),
	Chart Col( :Name( "Sum(Count, Recordable)" ), C ),
	SendToReport(
		Dispatch(
			{"C of Sum(Count, Near Miss)"},
			"Attributes Chart",
			FrameBox( 2 ),
			{Frame Size( 64, 208 )}
		)
	)
);
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Summary Table Script Help

When copying the table script for a summary table you actually want to copy the 'source' script that is automatically attached to the new data table. That script is usually pretty short and does not have New Column syntax in it (if you added new columns after the table was created you would first run the source script and then add the new columns). Try opening your data table and running this:

 

dt = current data table();

//Summary Table
dtSum = dt << Summary(
	Group( :Month Year ),
	Sum( :Count ),
	Subgroup( :Recordable ),
	Freq( "None" ),
	Weight( "None" ),
	output table name( "Sum of Count by Month" )
);

//Chart
dtSum << Control Chart(
	Sample Label( :Month Year ),
	Sample Size( 250 ),
	KSigma( 3 ),
	Chart Col( :Name( "Sum(Count, Near Miss)" ), C ),
	Chart Col( :Name( "Sum(Count, Non-Record)" ), C ),
	Chart Col( :Name( "Sum(Count, Recordable)" ), C ),
	SendToReport(
		Dispatch(
			{"C of Sum(Count, Near Miss)"},
			"Attributes Chart",
			FrameBox( 2 ),
			{Frame Size( 64, 208 )}
		)
	)
);