Hi,
I would like to convert column names to strings but I do not know how.
dt = Open( "$SAMPLE_DATA/Decathlon.jmp" );
col_names = dt << Get Column Names();
Show(col_names);
this leads to
col_names = {Name, Country, Score, Name("100m"), Long Jump, Shot Put, High Jump, Name("400m"), Name("100m hurdles"), Discus, Pole Vault, Javelin, Name("1500m")};
I would like to have something like this instead:
col_names = {"Name", "Country", "Score", "100m", "Long Jump", "Shot Put", "High Jump", "400m", "100m hurdles", "Discus", "Pole Vault", "Javelin", "1500m"};
Any idea?
Thank you for your help!
Thank you for your answer.
Unfortunately your code returns
{Empty()}
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}
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.
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?
suppose I have a single column name as a variable, how would I make that column name into a string? E.g. a user dialog selects a column, I want that column name as a string. Thanks.
the below will assign a string value of a columns name, for the first selected column in the current active data table.
dt = current data table();
theName = ((dt<<get selected columns)[1]) << get name;
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.
This works:
dt = current data table();
col_list = {"Column 1", "Column 2", "Column 3"};
dt << Group Columns("ColGroup", col_list);