BookmarkSubscribe
Choose Language Hide Translation Bar
newbie_alex
Community Trekker

Re: how to convert column names to a list of strings

Thank you for your answer.

 

Unfortunately your code returns

{Empty()}
0 Kudos
ian_jmp
Staff

Re: how to convert column names to a list of strings

I had some issues with the Community software, and you may have got an incomplete version. At any rate, the code there now gives me (JMP Pro 13.1 on a Mac):

{:height, :weight}

 

0 Kudos
newbie_alex
Community Trekker

Re: how to convert column names to a list of strings

Thanks you for the quick feedback.

I use JMP Pro 12.2.0. That might be the reason why our results differ
0 Kudos
ian_jmp
Staff

Re: how to convert column names to a list of strings

It's possible the expression for the Graph Builder saved script has changed, and if so, the way the script is parsed would need to be changed accordingly. I don't have that version installed so can't easily check.

 

But you should be able to use the general appoach.

0 Kudos
Highlighted
mela_ssa
Community Trekker

Re: how to convert column names to a list of strings

col_str = dt << Get Column Names( "String" ); works in JMP 13.



For JMP 12, use col_str = dt << Get Column Names( "String" );

As Ian suggested.


0 Kudos
dale_lehman
Community Trekker

Re: how to convert column names to a list of strings

Since your stated purpose is to have the same colors from Graph Builder apply to other graphs, could you use the Column Properties - Value Colors to accomplish what you want?

0 Kudos
pcarroll1
Community Trekker

Re: how to convert column names to a list of strings

I have the opposite problem. I need to convert a string list to a column name list.
I have a list of column names as strings, {"col1", "col2", "col3"}
I want to group those columns but that function needs the list to look like this:

dt << Group Columns("ColGroup", {:col1, :col2, :col3});

I've tried many permutations of eval, evapexpr and column but have not found the correct one.

0 Kudos
pmroz
Super User

Re: how to convert column names to a list of strings

This works:

dt = current data table();
col_list = {"Column 1", "Column 2", "Column 3"};

dt << Group Columns("ColGroup", col_list);
pcarroll1
Community Trekker

Re: how to convert column names to a list of strings

This worked but I needed to first make a group name variable.

j=1;

GN = "ColGroup"||j;

dt << Group Columns(GN, col_list);

worked.

But

dt << Group Columns("ColGroup"||j, col_list);

did not. 

It turned out this was the problem all along.

 

The error message made the problem look like it was with the column list.

0 Kudos