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
robot
Level VI

Update Col List Box

Hi,

I am trying to create a modal window where a Col List Box is updated based on user selection.  I think this is possible, but I am having trouble with the syntax.  Any suggestions?  I am using JMP12.

// Example.

Names Default To Here( 1 );

// Open some data tables.

Open( "$SAMPLE_DATA/Baseball.jmp" );

Open( "$SAMPLE_DATA/Basketball.jmp" );

Open( "$SAMPLE_DATA/Bicycle.jmp" );

// Get list of available tables.

tableList = {};

For( i = 1, i <= N Table(), i++,

       Insert Into( tableList, Data Table( i ) )

);

New Window( "Select a table",

       <<Modal,

       H List Box(

             Panel Box( "Select dt",

                    getDt = List Box(

                           tableList,

                           Max Selected( 1 ),

                           dt = getDt << Get Selected;

                           Print( dt );

                           // Add some script to update getCol with columns from dt.

                           // I suspect <<Append or <<Set is used, but I cannot get

                           // the syntax correct.

                    )

             ),

             Panel Box( "Select columns from dt", getCol = Col List Box() )

       )

);

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Update Col List Box

Try this approach:

// Example.

Names Default To Here( 1 );

// Open some data tables.

Open( "$SAMPLE_DATA/Baseball.jmp" );

Open( "$SAMPLE_DATA/Basketball.jmp" );

Open( "$SAMPLE_DATA/Bicycle.jmp" );

// Get list of available tables.

tableList = {};

For( i = 1, i <= N Table(), i++,

  Insert Into( tableList, Data Table( i ) )

);

New Window( "Select a table",

  <<Modal,

  H List Box(

   Panel Box( "Select dt",

     getDt = List Box(

       tableList,

       Max Selected( 1 ),

            // delete box that's there, replace with box using the selected table

       getCol << Delete Box();

       pb << Append(

         getCol = Col List Box(

                 // get selected returns a list

                 // you allow only one selected, so there's one item in the list

                 // so the first item in the list is the name of the one selected table

                 Data Table( (getDt << Get Selected)[1] ),

                 // without this, your box is blank

                 "all"

                 // can use this after "all" to restrict the columns to character or numeric

                 //,<<Set Data Type("numeric")

         )

       );

     )

   ),

     // give panel box a reference so you can append new col list boxes

   pb = Panel Box( "Select columns from dt", getCol = Col List Box() )

  )

);

View solution in original post

4 REPLIES 4

Re: Update Col List Box

Try this approach:

// Example.

Names Default To Here( 1 );

// Open some data tables.

Open( "$SAMPLE_DATA/Baseball.jmp" );

Open( "$SAMPLE_DATA/Basketball.jmp" );

Open( "$SAMPLE_DATA/Bicycle.jmp" );

// Get list of available tables.

tableList = {};

For( i = 1, i <= N Table(), i++,

  Insert Into( tableList, Data Table( i ) )

);

New Window( "Select a table",

  <<Modal,

  H List Box(

   Panel Box( "Select dt",

     getDt = List Box(

       tableList,

       Max Selected( 1 ),

            // delete box that's there, replace with box using the selected table

       getCol << Delete Box();

       pb << Append(

         getCol = Col List Box(

                 // get selected returns a list

                 // you allow only one selected, so there's one item in the list

                 // so the first item in the list is the name of the one selected table

                 Data Table( (getDt << Get Selected)[1] ),

                 // without this, your box is blank

                 "all"

                 // can use this after "all" to restrict the columns to character or numeric

                 //,<<Set Data Type("numeric")

         )

       );

     )

   ),

     // give panel box a reference so you can append new col list boxes

   pb = Panel Box( "Select columns from dt", getCol = Col List Box() )

  )

);

robot
Level VI

Re: Update Col List Box

Thanks Melanie!

robot
Level VI

Re: Update Col List Box

Hi Melanie,

A coworker of mine is using JMP11, where << Delete Box; seems to not work.  Do you know why?  Is there similar function to use for JMP version < 12?

getCol << Delete Box; // Not working for JMP11.

robot
Level VI

Re: Update Col List Box

Never mind.  I got it to work with this:

getCol << Delete; // This works for JMP11.