We’re asking you to select a content label when starting a new topic in the Discussions area. Read more to find out why.
Choose Language Hide Translation Bar
Highlighted
alecpena
Level I

How to remove control charts with empty columns

I have a large data table that I allow the user to filter down to a product to then create a subset and control charts. Products use different combinations of parameters so the main table and subset have empty columns that differ for each product. I would like to solve one of these problems:

 

  1. How can I create a dynamic list to feed into the control chart builder to only plot the parameters that are not empty for a given subset?
  2. How can I remove empty charts from the control chart builder after creation?

As an example, I have attached a subset of the Hot Dogs table with some parameters removed by Taste. Calories now has no data for all dogs with a Medium taste. In this instance, I would like to have every parameter plot but Calories, though it may be a different parameter for other Tastes.

 

alecpena_0-1584114263511.png

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: How to remove control charts with empty columns

Here is one way to handle the issue.  Just check to see if the column has all missing values, and if so, then do not include it into the list of good columns.

Names Default To Here( 1 );
dt = Current Data Table();
colNames = dt << get column names( string, continuous );

newcolNames = ":Name(\!"" || colNames[1] || "\!")";



For( i = 2, i <= N Items( colNames ), i++,
	If( Col Number( Column( colNames[i] ) ) != 0,
		newcolNames = newcolNames || ",:Name(\!"" || colNames[i] || "\!")"
	)
);

Eval(
	Parse(
		"Control Chart Builder(
	Size( 534, 456 ),
	Show Control Panel( 0 ),
	Show Capability( 0 ),
	Variables(
		Y("
		 || newcolNames || ")));"
	)
);
Jim

View solution in original post

1 REPLY 1
Highlighted
txnelson
Super User

Re: How to remove control charts with empty columns

Here is one way to handle the issue.  Just check to see if the column has all missing values, and if so, then do not include it into the list of good columns.

Names Default To Here( 1 );
dt = Current Data Table();
colNames = dt << get column names( string, continuous );

newcolNames = ":Name(\!"" || colNames[1] || "\!")";



For( i = 2, i <= N Items( colNames ), i++,
	If( Col Number( Column( colNames[i] ) ) != 0,
		newcolNames = newcolNames || ",:Name(\!"" || colNames[i] || "\!")"
	)
);

Eval(
	Parse(
		"Control Chart Builder(
	Size( 534, 456 ),
	Show Control Panel( 0 ),
	Show Capability( 0 ),
	Variables(
		Y("
		 || newcolNames || ")));"
	)
);
Jim

View solution in original post