Subscribe Bookmark RSS Feed

Control chart as script in button box

philip_kotliyak

Community Member

Joined:

Aug 11, 2014

Hey, im using JMP 9.0.3

Im trying to write script to make macro to generate control charts and save them to the file.

I encountered this error and i have no idea how to solve it, i looked for couple hours for solution and nothing seems to work.

the code is :

clear globals();

jrn=NewWindow("SPC Analysis "|| Format(today(),"yyyy-mm-dd"),VListBox(

                                                                      button box ("Choose JMP Data File",Data_Table=open(Pick File(),invisible);),

                                                                      global box(Data_Table),

                                                                      button box ("Choose Specification JMP File",Spec_Table=open(Pick File(),private);

                                                                                  for (i=2,i<=Ncol(Spec_Table),i++,

                      

                                                                                                      eval (

                                                                                                            eval expr(

                                                                                                                    column(Data_Table,i+1)<<Set Property("Spec Limits",{                                                                                                                    LSL(expr(column(Spec_Table,i)[1])),

                                                                                                                    TARGET(expr(column(Spec_Table,i)[2])),

                                                                                                                        USL(expr(column(Spec_Table,i)[3])) })

                                                                                                                    )

                                                                                                        )

                                                                                                      

                                                                                                    )

                                                                              ),

                                                                  global box(Spec_Table),

                                                                  button box ("Run XBar Control Chart",cc=

                                                                                                      Control Chart (

                                                                                                      Sample Label ( :column(1) ),

                                                                                              KSigma( 3 ),

                                                                                              Chart Col( : column(Data_Table,3) ,XBar,S)

                                                                                            )

                                                                            )

                                                                    )

                                                                

                                                              

                                                                  

                                                                  

            );

close all(Data Tables,no save);

the error is at the red part, if i just run the control chart function, it works, if as sript inside button box, it doesnt.

Thanks.

1 REPLY
pmroz

Super User

Joined:

Jun 23, 2011

You have a non-modal dialog box, which means that everything gets executed, including the closeall at the end.  I would add a Close button to your dialog box that executes the closeall instead of how you're doing it.

Clear Globals();

jrn = New Window( "SPC Analysis " || Format( Today(), "yyyy-mm-dd" ),

    V List Box(

        Button Box( "Choose JMP Data File",

            Data_Table = Open( Pick File(), invisible )

        ),

            Global Box( Data_Table ),

            Button Box( "Choose Specification JMP File",

            Spec_Table = Open( Pick File(), private );

            For( i = 2, i <= N Col( Spec_Table ), i++,

                Eval(Eval Expr(

                    Column( Data_Table, i + 1 ) << Set Property("Spec Limits",

                            {LSL( Expr( Column( Spec_Table, i )[1] ) ),

                            TARGET( Expr( Column( Spec_Table, i )[2] ) ),

                            USL( Expr( Column( Spec_Table, i )[3] ) )}

                        )

                    )

                )

            );

        ),

            Global Box( Spec_Table ),

            Button Box( "Run XBar Control Chart",

            cc = Control Chart(

                Sample Label( :column( 1 ) ),

                KSigma( 3 ),

                Chart Col( :column( Data_Table, 3 ), XBar, S )

            )

        ),

            button box("Close", Close All( Data Tables, no save );

                    jrn << close window;

        )

    )

);