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
gwhitcomb
Level I

Tabulate in script not creating table seen in control panel

I am trying to tabulate a table and use a filter simultaneously to create a table that pulls out 6 rows of data that I can then join to another data table. The table that I see in my control panel is correct but when the script runs and creates the data table I am getting different data. Below is the code I use and 2 screen shots. Why is the table created different than the table seen in the control panel?

(Data Table("SILZone")<<Tabulate(

     Add Table(

          Column Table(

                          Analysis Columns( :Name( "Sum(BOTTLESOUT)" ) ),

            Statistics( Mean, Sum )

            ),

            Row Table( Grouping Columns(:DATE, :SHOP, :LOOP ) )

      ),

      Local Data Filter(

            Location( {208, 121} ),

            Add Filter(

                  columns( :ZONENAME, :LOOP ),

                  Where( :ZONENAME == "Gob Cuts" ),

                  Where( :LOOP == 0 ),

                  Display( :ZONENAME, Size( 284, 259 ), List Display )

            ),

            Mode( Select( 0 ), Show( 1 ), Include( 1 ) )

));

<< Make Into Data Table;

=current data table();

<<set name("GobCuts");

From the tabulate control panel. This is the table I want:

4592_controlpanel.png

This is what I get when I run the script:

4593_table.png

1 ACCEPTED SOLUTION

Accepted Solutions
pmroz
Super User

Re: Tabulate in script not creating table seen in control panel

Try using get rows instead of a local data filter.  Here's some code:

dt = Data Table("SILZone");

current data table(dt);

selected_mtx = dt << get rows where(:ZONENAME == "Gob Cuts" & :LOOP == 0 );

if (nrows(selected_mtx) > 0,

    dt << select rows(selected_mtx) << invert row selection << exclude << clear select;

    dt_tab = dt << Tabulate(

        Add Table(

            Column Table( Analysis Columns( :Name( "Sum(BOTTLESOUT)" ) ),

                Statistics( Mean, Sum )

                ),

                Row Table( Grouping Columns(:DATE, :SHOP, :LOOP ) )

        ), invisible

    );

    dt2 = dt_tab << Make Into Data Table;

    dt_tab << close window;

    dt2 << set name("GobCuts");

    dt << clear row states;

);

View solution in original post

2 REPLIES 2
pmroz
Super User

Re: Tabulate in script not creating table seen in control panel

Try using get rows instead of a local data filter.  Here's some code:

dt = Data Table("SILZone");

current data table(dt);

selected_mtx = dt << get rows where(:ZONENAME == "Gob Cuts" & :LOOP == 0 );

if (nrows(selected_mtx) > 0,

    dt << select rows(selected_mtx) << invert row selection << exclude << clear select;

    dt_tab = dt << Tabulate(

        Add Table(

            Column Table( Analysis Columns( :Name( "Sum(BOTTLESOUT)" ) ),

                Statistics( Mean, Sum )

                ),

                Row Table( Grouping Columns(:DATE, :SHOP, :LOOP ) )

        ), invisible

    );

    dt2 = dt_tab << Make Into Data Table;

    dt_tab << close window;

    dt2 << set name("GobCuts");

    dt << clear row states;

);

gwhitcomb
Level I

Re: Tabulate in script not creating table seen in control panel

Thank you! That works perfectly. I had been playing around with get rows and couldn't get it to work. I appreciate your help!