cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP Security Notice: CVE-2026-109618 and CVE-2026-109619

    JMP promptly initiated a review of its products, services, and relevant infrastructure for exposure to CVE-2026-109618 and CVE-2026-109619.

    Our assessment of JMP products has not identified exposure to these vulnerabilities. Where remediation was required within supporting environments, appropriate security updates and controls have been applied and validated.

    We have identified no evidence of successful exploitation or unauthorized access to JMP systems or customer information associated with these vulnerabilities.

    JMP continues to monitor the issue and relevant vendor guidance. No action is required by JMP customers at this time.

  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
newbie_alex
Level III

how to convert column names to a list of strings

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!

 

20 REPLIES 20
newbie_alex
Level III

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

Thank you for your answer.

 

Unfortunately your code returns

{Empty()}
ian_jmp
Level X

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}

 

newbie_alex
Level III

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
ian_jmp
Level X

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.

mela_ssa
Level III

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.


dale_lehman
Level VII

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?

bayesfactor
Level III

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

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.

txnelson
Super User

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

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;
Jim
pcarroll1
Level IV

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.

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);

Recommended Articles