Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
0 Kudos

data table : message column exists(colname)?

☐ cool new feature
☑ could help many users!

☑ removes a „bug“

☐ nice to have

☐ nobody needs it


Is there a column colname in my data table?
This is one of the questions which are asked most often in the community:


So, it seems that it's not straightforward enough, how it is implemented at the moment.


But it is even more interesting - and bears a lot of dangers.
A user who doesn't know about the stumbling blocks associated with JSL naming conventions, most probably just writes

Contains( dt << Get Column Names(String), "age" )

into his code. Quite easy ...
but extremely dangerous - see:

What looks like strange discussions of some jsl scripting nerds shows that the above statement, sure, will work for many cases, but:
will fail once spaces, capital letters, special character are in the column names.


To prevent users from using such dangerous code, it's the best to "instutionalize"

- i.e. provide the users an easy solution which accounts automatically for all pitfalls.


My wish:
it should be possible to ask a data table:


dt << contains column("colname")



This function can account for all pitfalls:

- compare with exact match - or check match for as name("colname"), accounting for spaces

- distinguish or don't distinguish lower/capital letters

- handle special characters


The benefit:

- less questions in the community

- automatically better code.

- less frustration.


more wishes submitted by  hogi_2-1702196401638.png

Super User

It could be better to make JMP understand that those are either same or different column names? This could of course break things, so might not be so easy to implement.


Something is a bit confusing here:

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big");
dt:age << set name("a g e");
dt:age[1] = 999;

Show(Column(dt, "age")); //Column(dt, "age") = Column("a g e");
Show(dt:age[1]); //dt:age[1] = 999;

dt << New Column("age", Numeric, Ordinal);
Show(Column Name(2) == Column Name(6)); // Column Name(2) == Column Name(6) = 1; // Columns don't need unique names?
Show(Column(dt, "age")); //Column(dt, "age") = Column("age");
dt:age[1] = 9999;
Show(dt:age[1]); //dt:age[1] = 9999;


dt << Delete Column("age");
Show(Column(dt, "age")); //Column(dt, "age") = Column("a g e");
Show(dt:age[1]); //dt:age[1] = 999;

Do columns follow some specific naming? Do follow names are required to start with alphabetic characters or underscore, but whitespaces do matter (sometimes) for columns. Maybe the issue (if there is one) is just how column referencing works?

Status changed to: Acknowledged

Hi @hogi, thank you for your suggestion! We have captured your request and will take it under consideration.


Thank you @hogi, and @jthi for commenting. Changing the status to investigating.

Status changed to: Investigating
Status changed to: Yes, Stay Tuned!

Development is exploring a solution: "to have a message on the table to ask directly, like dt << Has Column("age") , potentially with an option to give different answers if you want Exact matches or Name (space and case insensitive) matches".


Changing to Yes, Stay Tuned.

Level XI


Status changed to: Delivered

This is in JMP 18.