BookmarkSubscribeSubscribe to RSS Feed

How to write a script that will pick columns that are continuous and have spec limits property for the process capability analysis


Community Member


Jul 21, 2016

Firstly setting the spec limits for the file dt7 from the file dt8

dt7 = Open( path || "" );

dt8 = Open( path || "" );

Current Data Table( dt8 );

For Each Row(





  Column( dt7, :Test ) << set property(

  "Spec Limits",

  {LSL( l ), USL( u )}



  Expr( l ), :Limit Min,

  Expr( u ), :Limit Max





Once the specs are assigned I would like to plot the capability analysis for the columns that are continuous and have spec limits.

There are about 300 (Tests that are done and I do not want to manually select the columns)

ColName1 = dt7 << GetColumnNames( numeric, continuous );

repWin = New Window( "Capability", container = V List Box() );

N = N Items( ColName1 );

For(k = 1, k <= N, k++,

  Q = dt7<<ColName1 << Get Property( "Spec limits" );

  usl = Q["USL"];

  lsl = Q["LSL"];

  If(lsl == Empty(),k++,

  content = V List Box(

  dt7<<Process Capability(

  Process Variables({ColName1}),

    Individual Detail Reports( 1 ),

    Capability Box Plots( 1 ),

    Goal Plot(1),

    Goal Plot( 0, Show Within Sigma Points( 1 ), Show Overall Sigma Points( 0 ) ),

    {ColName1 << Process Capability Analysis(

    Overall Sigma Capability( 0 ),

    Nonconformance( 0 ),

  Histogram( 0 ))}



  container << Append( content );




Super User


Mar 20, 2012


I think the 8th line of code should read:

IF ( IsEmpty( lsl ), continue(),

Do you care about one-sided limits?




Apr 26, 2012

This might be easier with the Process Capability Platform.  This example is mostly from the scripting index with a couple of little extra bits.

It opens the spec table, opens the data table, saves the specs to the data table (not necessary but useful) and then pulls the summary report out as a data table.  Not so long ago I wrote a script to do this using the distribution platform, it was very slow and the script was ten times longer.

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/" );

dty = dt << GetColumnNames( numeric, continuous );

n = N Items( dty );

y = Expr( process variables() );  //this constructs the "process variables" argument that is inside the process capability function.

For( i = 1, i <= n, i++,

      Insert Into( y, dty[i] )            // ​the column names, not name strings, are inserted and comma delimited


obj = Expr(                              //​ this is an expression so that it won't be evaluated and we can do things to it later

      Process Capability(

            Spec Limits( Import Spec Limits( "$SAMPLE_DATA/" ) ),

            Spec Limits Dialog( "No (skip columns with no spec limits)" ),                           // Handy thing to know, Thank you Dr. Lancaster!!

            Overall Sigma Summary Report( 1 )



Insert Into( obj, Name Expr( y ) );        //  this is later and we insert "y" which is "process variables( column names )"  show( name expr(y)) to see it

pr = obj << report;                          // pr becomes a handle for the report, and obj gets evaluated

tb = pr[Table Box( 2 )];                   // this is where the the summary report is in the capability report

dt2=tb << Make Into Data Table;

// and now you can start throwing your graph scripts and custom reports  at dt2 .

JMP Systems Engineer, Pharm and BioPharm Sciences