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

how to assign a column to a list?

In JSL, there is a column diag function in which a column in a table can be assigned to a list by using ColList function. When the script is run, user needs to click on a button to make the assignment happens. It requires interactive user input.

Col_dlg = ColumnDialog(

  Title("Variable Assignment"),

  ::x = ColList("Run ID", MinCol(1), MaxCol(1), Columns(:LOT)),

   .....

);

Is there a way to write a script such that a column can be assigned to a list without user clicking on the button on the dialog window (no dialog window will be shown when it runs)?

I tried:

::x = ColList("Run ID (Required)", MinCol(1), MaxCol(1), Columns(:LOT));

::x = :LOT << Get Values;

::x = Column(dt,"LOT");

all failed. Any clues?

1 ACCEPTED SOLUTION

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

Re: how to assign a column to a list?

I don't see any specific reason to mimic the ColList output here, but you can create a list with a column like this:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

col= {column(dt,"Name")};

column(dt,col)<< Set Property("Row Order Levels", (1));


But for your example a normal column variable is more straight forward:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

col= column(dt,"Name");

col<< Set Property("Row Order Levels", (1));


Still another way based on a list of columns:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

::x = (dt << get column names())[1];

::x << Set Property( "Row Order Levels", (1) );

View solution in original post

4 REPLIES 4
pmroz
Super User

Re: how to assign a column to a list?

Your second to last try should have worked, but perhaps the table containing the LOT column wasn't the current table.  The following syntax all works:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

x1 = :name << get values;

x2 = column(dt, "name") << get values;


Make sure the variable pointing to your data table is set.  For example:

dt = data table("MyLots");    // Table containing LOT column

::x = Column(dt, "LOT") << Get Values;

Re: how to assign a column to a list?

Yes, by using

::x2 = Column(dt, "LOT") << Get Values;

will give me a list with all values under the Column LOT, but this ::x2 will not "act" exactly like the ::x assigned by using the ColList function from the Column Diag. For example, the following command

Column(dt, Eval(x)) << Set Property("Row Order Levels", (1));

with the ::x assigned by using the ColList function, but will get error when I call

Column(dt, Eval(x2)) << Set Property("Row Order Levels", (1));

The error msg is: 

"could not find column in access or evaluation of 'Column' , Column( dt, Eval( x ) )"

For the ::x assigned by ColList function, Eval(x) will give me "LOT";

For the ::x2 assigned in this way, Eval(x) will give me a list with all the values under Column LOT.

What I like to do is: to find a way to assign column to a list, EXACTLY act like the ColList function, but without user interface with the diaglog window or user interactive respond. If anyone can provide me the codes for the ColList function, it would be great!

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

Re: how to assign a column to a list?

I don't see any specific reason to mimic the ColList output here, but you can create a list with a column like this:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

col= {column(dt,"Name")};

column(dt,col)<< Set Property("Row Order Levels", (1));


But for your example a normal column variable is more straight forward:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

col= column(dt,"Name");

col<< Set Property("Row Order Levels", (1));


Still another way based on a list of columns:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

::x = (dt << get column names())[1];

::x << Set Property( "Row Order Levels", (1) );

Re: how to assign a column to a list?

Sorry, my fault. My explanation was not clear. What I like to do is to use robust global var assignments to some columns to replace the Column Diag function so that no user interactive respond will be required. Here is the situation:

in my main routine, there is a Column Diag in which some columns are assigned to some global variables, which will be called in many existing functions in libaries. There are some commands used in those lib functions:

N_x = NItems(x);

Column(dt, Eval(x2)) << Set Property("Row Order Levels", (1));

Variability Chart(...)

Bivariate(..)

....

No change in those lib functions is allowed. Currently, the global variables assigned by using the Column Diag function work well without any issue with the existing lib functions. But all the tries suggested above may work for some commands, but get errors others.

Hope that my explanation this time is clear :-). Or probably add more confusion :-(.

John