cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
swiergi11
Level III

Issues with recognizing an argument in the script

Hi,

Can someone please have a look at my script and give me an idea what I'm doing wrong.

Trying to select and argument using comb box which ten is incorporated into the column name and based on that column im trying to generate control chart using the adjusted column name but it doesn't work.

 

Names Default To Here( 1 );
New Window( "Data selection",
    <<Modal,
    Panel Box( "Select a Date Range",
        Lineup Box( N Col( 1 ), 

            Text Box( "Chart ID" ), 

            rr_cb = Combo Box(
                {"D0585DI", "D0585IG", "D0585L3", "D0585L2", "D0585L1"},
                <<Set Width( 5 )
            )
        )
    ), 

    H List Box(
        Button Box( "OK",
            <<Set Function(
                Function( {self}, 

                    layer = rr_cb << GetText;

                )
            )
        ),
        Button Box( "Cancel" )
    )
);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
//changing the "weight"" column name to RSM_"whichever chosen argument from combo box"
:weight << Set Name( "RSM_" || layer );
//Creat control chart using RSM_"whichever choosen argument from combo box"
dt << Control Chart(
    Sample Label( :name ),
    Chart Col(
        :"RSM_" || layer,
        Levey Jennings(
            Show Zones( 1 ),
            Shade Zones( 1 ),
            Test 1( 1 ),
            Test 2( 1 ),
            Test 5( 1 ),
            Test 6( 1 ),
            Test Beyond Limits( 1 )
        ),
        Capability(
            Distribution(
                Continuous Distribution(
                    Column( :"RSM_" || layer ),
                    Quantiles( 0 ),
                    Horizontal Layout( 1 ),
                    Vertical( 0 ),
                    Outlier Box Plot( 0 ),
                    Normal Quantile Plot( 1 ), 
//Fit Distribution( "All" ),
                    Process Capability(
                        Use Column Property Specs,
                        Process Capability Analysis(
                            Process Summary( 1 ),
                            Nonconformance( 0 ),
                            Within Sigma Capability( 1 ),
                            Histogram( 1, Show Within Sigma Density( 1 ) )
                        )
                    ),
                    Customize Summary Statistics( Skewness( 1 ) ), 
                )
            )
        )
    )
);

 

Thanks,

Tomasz

2 ACCEPTED SOLUTIONS

Accepted Solutions
SDF1
Super User

Re: Issues with recognizing an argument in the script

Hi @swiergi11 ,

 

  Not sure why your existing code doesn't work. I tried something similar in the sense of wanting to have the capability analysis as part of the call within the Control Chart() call, but it doesn't "activate" it. There is another work around that you can send the command to the "object" that is the control chart and have it perform the analysis.

 

  Also, you'll probably want to include the LSL, USL, and Target as column properties so that it automatically performs the correct analysis. You need to assign them using the <<Set Property() command. I've included the code below.

 

Hope this helps!,

DS

Names Default To Here( 1 );
New Window( "Data selection",
	<<Modal,
	Panel Box( "Select a Date Range",
		Lineup Box( N Col( 1 ), 

			Text Box( "Chart ID" ), 

			rr_cb = Combo Box( {"D0585DI", "D0585IG", "D0585L3", "D0585L2", "D0585L1"}, <<Set Width( 5 ) )
		)
	), 

	H List Box(
		Button Box( "OK",
			<<Set Function(
				Function( {self}, 

					layer = rr_cb << GetText;

				)
			)
		),
		Button Box( "Cancel" )
	)
);

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
//changing the "weight"" column name to RSM_"whichever chosen argument from combo box"
:weight << Set Name( "RSM_" || layer );
//Creat control chart using RSM_"whichever choosen argument from combo box"

Ycol = "RSM_" || layer;
Xcal = "RSM_" || layer;

//define your spec limits
_LSL_ = 0;
_USL_ = 100;
_Target_ = 20;

//assign the spec limits to the column of interest
Eval( Eval Expr( Column( dt, YCol ) << Set Property( "Spec Limits", {LSL( Expr( _LSL_ ) ), USL( Expr( _USL_ ) ), Target( Expr( _Target_ ) )} ) ) );

//creates the control chart object cc_obj
cc_obj = dt << Control Chart(
	Sample Label( :name ),
	KSigma( 3 ),
	Chart Col(
		As Column( Ycol ),
		Levey Jennings( Show Zones( 1 ), Shade Zones( 1 ), Test 1( 1 ), Test 2( 1 ), Test 5( 1 ), Test 6( 1 ), Test Beyond Limits( 1 ) )
	)
);

//sends the Capability command to the cc_obj to update the window
cc_obj << Capability(
	As Column( Ycol ),
	LSL( Expr( _LSL_ ) ),
	USL( Expr( _USL_ ) ),
	Target( Expr( _Target_ ) ),
	Quantiles( 0 ),
	n
	Summary Statistics( 0 ),
	Outlier Box Plot( 0 ),
	Normal Quantile Plot( 1 ),
	Process Capability( Use Column Property Specs ),
	Capability Analysis( LSL( Expr( _LSL_ ) ), USL( Expr( _USL_ ) ), Target( Expr( _Target_ ) ), Shewhart )
);

View solution in original post

Georg
Level VII

Re: Issues with recognizing an argument in the script

Dear @swiergi11 ,

my experience is that sometimes variable replacement in messages works and sometimes not. So what you can help here is building an expression, replace variables, and then excute the expression. 

This works for the simplified example below similar to your task.

BR

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

Ycol = "weight";
Xcal = "height";

cc_expr = Expr(
	dt << Control Chart(
		Sample Label( :name ),
		KSigma( 3 ),
		Chart Col(
			Expr( column(Ycol) ),
			Levey Jennings( Show Zones( 1 ), Shade Zones( 1 ), Test 1( 1 ), Test 2( 1 ), Test 5( 1 ), Test 6( 1 ), Test Beyond Limits( 1 ) ),
			Capability(
				Distribution(
					Continuous Distribution(
						Column( Expr(Xcal ) ),
						Quantiles( 0 ),
						Summary Statistics( 0 ),
						Outlier Box Plot( 0 ),
						Normal Quantile Plot( 1 ),
						Capability Analysis( LSL( 90 ), USL( 110 ), Target( 105 ), Sigma( 22.2018710230259 ), Shewhart )
					)
				)
			)
		)
	)
);

eval(Eval Expr( cc_expr ));
Georg

View solution in original post

5 REPLIES 5
SDF1
Super User

Re: Issues with recognizing an argument in the script

Hi @swiergi11 ,

 

  I think one of the problems is how you reference the column in the Chart Col() part of the Control Chart(). The problem is that it's not evaluating the :"RSM_"||level as a column, just the :"RSM_" part and so it doesn't know what to do with the ||layer concatenation.

 

  As a workaround, you can evaluate the concatenation before you call the Control Chart with something like:   Ycol="RSM_"||layer; then, instead of :"RSM_"||layer as the Chart Col(), use: Cart Col( As Column(Ycol) ), and you'll be able to run the script as you expect.

 

  Here's the modified code below:

Names Default To Here( 1 );
New Window( "Data selection",
      <<Modal,
      Panel Box( "Select a Date Range",
             Lineup Box( N Col( 1 ),

                    text box("Chart ID"),

                   rr_cb = Combo Box( {"D0585DI", "D0585IG","D0585L3","D0585L2", "D0585L1"}, <<Set Width( 5 ) ))),

      H List Box(
             Button Box( "OK",
                   <<Set Function(
                         Function( {self},
                            
                                 layer = rr_cb << GetText;
                               
                         )
                   )
             ),
             Button Box( "Cancel" )
      )
);

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
//changing the "weight"" column name to RSM_"whichever chosen argument from combo box"
:weight << Set Name("RSM_"||layer);
//Creat control chart using RSM_"whichever choosen argument from combo box"

Ycol="RSM_"||layer;

dt << 
Control Chart(
	Sample Label( :name),	
		Chart Col(
			As Column(Ycol),
			Levey Jennings(
			Show Zones( 1 ),Shade Zones( 1 ),
			Test 1( 1 ),
			Test 2( 1 ),
			Test 5( 1 ),
			Test 6( 1 ),
			Test Beyond Limits( 1 )			
		),
			Capability(
			Distribution(
				Continuous Distribution(
					 Column(:"RSM_"||layer),
					Quantiles( 0 ),
					Horizontal Layout( 1 ),
					Vertical( 0 ),
					Outlier Box Plot( 0 ),
					Normal Quantile Plot( 1 ),
					//Fit Distribution( "All" ),
					Process Capability(
						Use Column Property Specs,
						Process Capability Analysis(
							Process Summary( 1 ),
							Nonconformance( 0 ),
							Within Sigma Capability( 1 ),
							Histogram( 1, Show Within Sigma Density( 1 ) )
						)
					),
					Customize Summary Statistics( Skewness( 1 ) ),
					
			)
		)
	)
		));

Hope this helps!,

DS

  

swiergi11
Level III

Re: Issues with recognizing an argument in the script

 Very Nice, thanks a lot. 

I can generate control charts but for some reason cannot follow through with statistic, seems like second part of the control chart script has still problem.

Tried to get another argument but no luck. 

 

Names Default To Here( 1 );
New Window( "Data selection",
	<<Modal,
	Panel Box( "Select a Date Range",
		Lineup Box( N Col( 1 ), 

			Text Box( "Chart ID" ), 

			rr_cb = Combo Box(
				{"D0585DI", "D0585IG", "D0585L3", "D0585L2", "D0585L1"},
				<<Set Width( 5 )
			)
		)
	), 

	H List Box(
		Button Box( "OK",
			<<Set Function(
				Function( {self}, 

					layer = rr_cb << GetText;

				)
			)
		),
		Button Box( "Cancel" )
	)
);

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
//changing the "weight"" column name to RSM_"whichever chosen argument from combo box"
:weight << Set Name( "RSM_" || layer );
//Creat control chart using RSM_"whichever choosen argument from combo box"

Ycol = "RSM_" || layer;
Xcal = "RSM_" || layer;
dt << Control Chart(
	Sample Label( :name ),
	KSigma( 3 ),
	Chart Col(
		As Column( Ycol ),
		Levey Jennings(
			Show Zones( 1 ),
			Shade Zones( 1 ),
			Test 1( 1 ),
			Test 2( 1 ),
			Test 5( 1 ),
			Test 6( 1 ),
			Test Beyond Limits( 1 )
		),
		Capability(
			Distribution(
				Continuous Distribution(
					Column( As Column( Xcal ) ),
					Quantiles( 0 ),
					Summary Statistics( 0 ),
					Vertical( 0 ),
					Outlier Box Plot( 0 ),
					Normal Quantile Plot( 1 ),
					Capability Analysis(
						LSL( 0 ),
						USL( 100 ),
						Target( 20 ),
						Sigma( 22.2018710230259 ),
						Shewhart
					)
				)
			)
		)
	)
);

 

I hope to see the report as below:

 

swiergi11_0-1638374231597.png

 

SDF1
Super User

Re: Issues with recognizing an argument in the script

Hi @swiergi11 ,

 

  Not sure why your existing code doesn't work. I tried something similar in the sense of wanting to have the capability analysis as part of the call within the Control Chart() call, but it doesn't "activate" it. There is another work around that you can send the command to the "object" that is the control chart and have it perform the analysis.

 

  Also, you'll probably want to include the LSL, USL, and Target as column properties so that it automatically performs the correct analysis. You need to assign them using the <<Set Property() command. I've included the code below.

 

Hope this helps!,

DS

Names Default To Here( 1 );
New Window( "Data selection",
	<<Modal,
	Panel Box( "Select a Date Range",
		Lineup Box( N Col( 1 ), 

			Text Box( "Chart ID" ), 

			rr_cb = Combo Box( {"D0585DI", "D0585IG", "D0585L3", "D0585L2", "D0585L1"}, <<Set Width( 5 ) )
		)
	), 

	H List Box(
		Button Box( "OK",
			<<Set Function(
				Function( {self}, 

					layer = rr_cb << GetText;

				)
			)
		),
		Button Box( "Cancel" )
	)
);

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
//changing the "weight"" column name to RSM_"whichever chosen argument from combo box"
:weight << Set Name( "RSM_" || layer );
//Creat control chart using RSM_"whichever choosen argument from combo box"

Ycol = "RSM_" || layer;
Xcal = "RSM_" || layer;

//define your spec limits
_LSL_ = 0;
_USL_ = 100;
_Target_ = 20;

//assign the spec limits to the column of interest
Eval( Eval Expr( Column( dt, YCol ) << Set Property( "Spec Limits", {LSL( Expr( _LSL_ ) ), USL( Expr( _USL_ ) ), Target( Expr( _Target_ ) )} ) ) );

//creates the control chart object cc_obj
cc_obj = dt << Control Chart(
	Sample Label( :name ),
	KSigma( 3 ),
	Chart Col(
		As Column( Ycol ),
		Levey Jennings( Show Zones( 1 ), Shade Zones( 1 ), Test 1( 1 ), Test 2( 1 ), Test 5( 1 ), Test 6( 1 ), Test Beyond Limits( 1 ) )
	)
);

//sends the Capability command to the cc_obj to update the window
cc_obj << Capability(
	As Column( Ycol ),
	LSL( Expr( _LSL_ ) ),
	USL( Expr( _USL_ ) ),
	Target( Expr( _Target_ ) ),
	Quantiles( 0 ),
	n
	Summary Statistics( 0 ),
	Outlier Box Plot( 0 ),
	Normal Quantile Plot( 1 ),
	Process Capability( Use Column Property Specs ),
	Capability Analysis( LSL( Expr( _LSL_ ) ), USL( Expr( _USL_ ) ), Target( Expr( _Target_ ) ), Shewhart )
);
Georg
Level VII

Re: Issues with recognizing an argument in the script

Dear @swiergi11 ,

my experience is that sometimes variable replacement in messages works and sometimes not. So what you can help here is building an expression, replace variables, and then excute the expression. 

This works for the simplified example below similar to your task.

BR

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

Ycol = "weight";
Xcal = "height";

cc_expr = Expr(
	dt << Control Chart(
		Sample Label( :name ),
		KSigma( 3 ),
		Chart Col(
			Expr( column(Ycol) ),
			Levey Jennings( Show Zones( 1 ), Shade Zones( 1 ), Test 1( 1 ), Test 2( 1 ), Test 5( 1 ), Test 6( 1 ), Test Beyond Limits( 1 ) ),
			Capability(
				Distribution(
					Continuous Distribution(
						Column( Expr(Xcal ) ),
						Quantiles( 0 ),
						Summary Statistics( 0 ),
						Outlier Box Plot( 0 ),
						Normal Quantile Plot( 1 ),
						Capability Analysis( LSL( 90 ), USL( 110 ), Target( 105 ), Sigma( 22.2018710230259 ), Shewhart )
					)
				)
			)
		)
	)
);

eval(Eval Expr( cc_expr ));
Georg
swiergi11
Level III

Re: Issues with recognizing an argument in the script

thanks a lot Georg and DS, works well now. 

 

Both above solutions works.