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
uwe_hiss
Level II

How can I pass a listbox selection properly to select where?

Dear all,

I'm very new in JMP and JSL.

How can I pass a listbox selection properly to select where?

It looks, the brackets {} are the problem.

Preferences(Excel Has Labels(1), Excel Selection(1));

dt= Open( Pick File( " "));

New Window( " ",

<<Modal,

vlist box(

Text Box("Select ..."),

mon = listbox({"Jan 15", "Mar 15", "May 15"}),

Button Box( "OK", cho = mon<< get selected),

));

show (cho);

dt << Select Where( :Stage == cho);

dt << invert row selection;

dt << delete rows;

Is there a way to fill a Listbox with all values from a named column (Stage) without doubles?

Many thanks,

Uwe

1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: How can I pass a listbox selection properly to select where?

The list brackets won't be a problem if you use Contains() instead of ==, which also would support selection of multiple items.

dt << Select Where(Contains(cho, :Stage));

For for character columns the below command should fill a list box with unique column values.

mon = List Box(:Stage << get values)

View solution in original post

4 REPLIES 4
pmroz
Super User

Re: How can I pass a listbox selection properly to select where?

In your case "cho" is a list, since you could make multiple selections.  I've modified your code so that a) you can only choose one item, and b) it pulls the item from the list for proper use.

dt = Open( Pick File( " " ) );

New Window( " ", <<Modal,

     V List Box(

           Text Box( "Select ..." ),

           mon = List Box( {"Jan 15", "Mar 15", "May 15"}, max selected( 1 ) ),

           Button Box( "OK", cho_list = mon << get selected ),

     )

);

cho = cho_list[1];

Show( cho );

dt << Select Where( :Stage == cho );

dt << invert row selection;

dt << delete rows;

ms
Super User (Alumni) ms
Super User (Alumni)

Re: How can I pass a listbox selection properly to select where?

The list brackets won't be a problem if you use Contains() instead of ==, which also would support selection of multiple items.

dt << Select Where(Contains(cho, :Stage));

For for character columns the below command should fill a list box with unique column values.

mon = List Box(:Stage << get values)

uwe_hiss
Level II

Re: How can I pass a listbox selection properly to select where?

Hi,

thanks for both solutions, it works fine.

At moment the if clauses makes headache.

My Idea:

If the selected item (in List Box) == "Baseline" do not invert the selected rows on table but delete.

Otherwise invert and delete.

//!

clear log();

clear globals();

dt= Open( Pick File(" "));

New Window( " ", <<Modal,

V List Box(

  Text Box("Select ..."),

  mon = List Box(:Stage << get values),

  Button Box( "OK", cho = mon << get selected),

  )

);

dt << Select Where(Contains(cho, :Stage));

if (

  cho == "Baseline", dt << delete rows,

);

dt << invert row selection;

dt << delete rows;

Control Chart Builder(

  Show Control Panel( 0 ),

  Variables( Y( :Assay ) ),

  Chart(

  Position( 1 ),

  Warnings( Test 1( 1 ), Test 2( 1 ), Test 3( 1 ), Test 5( 1 ), Test 6( 1 ) )

  ),

  Chart( Position( 2 ) ),

  SendToReport(

  Dispatch( {}, "Control Chart Builder" , FrameBox, {Marker Size( 2 )} ),

  Dispatch( {}, "Control Chart Builder" , FrameBox( 2 ), {Marker Size( 2 )} )

  )

);

Whats wrong?

Regards,

Uwe

ms
Super User (Alumni) ms
Super User (Alumni)

Re: How can I pass a listbox selection properly to select where?

Looks like the end parenthesis is misplaced. Move it to after the "else" commands

If(cho == "Baseline",

    dt << delete rows,

    dt << invert row selection;

    dt << delete rows

);