Subscribe Bookmark RSS Feed

Problem with evaluate columns name

swaiper

Community Trekker

Joined:

Apr 28, 2015

Hi everyone,

After looking around the forum, I can't found a solution to solve my problem.

I have a csv file and I want to get all values for a column in a variable.

I try this code :

itemChoose = rbEngine <<Get Selected;

valuesMatrix = Eval(Parse(Eval Expr(Expr(itemChoose)))) << Get Values;

Show( valuesMatrix );

I have try this too :

  • valuesMatrix = Eval(Parse(Eval(itemChoose))) <<Get Values
  • valuesMatrix = Eval(Parse(Eval (as column(itemChoose)))) <<Get Values
  • valuesMatrix = Eval(Parse(Eval (^itemChoose^[]))) <<Get Values

But nothing work :/

Hope someone can help me

Thanks per advance,

Sincerely

3 REPLIES
ms

Super User

Joined:

Jun 23, 2011

The solution depends on what itemChoose represents. Is it a column variable or a list (with one or more columns)?

Below an example that works if itemChoose is a list:

dt = Current Data Table();

itemChoose = dt << get selected columns; // itemChoose will be a list like {:Data}

valuesMatrix = itemChoose[1] << get values; // get Matrix with all values of the first column in itemChoose

swaiper

Community Trekker

Joined:

Apr 28, 2015

Thanks for the answer,

I'm using a radiobox that's why I do a Get Selected.

So itemChoose is a single variable, not a list.

itemChoose in this case is equal to on of the datatable columns (for exemple, APA) but

valuesMatrix = itemChoose << get values

return me an error :

8902_pastedImage_0.png

Thanks per advance,

Sincerely

pmroz

Super User

Joined:

Jun 23, 2011

dt = open("$sample_data\Big Class.jmp");

col_list = dt << get column names(numeric, string);

New Window( "Get Column Matrix", << modal,

       rb = Radio Box(col_list),

      

       ok_btn = button box("OK",

              one_col = rb << get selected;

       );

);

col_mtx = column(dt, one_col) << get as matrix;