☐ 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:
https://community.jmp.com/t5/Discussions/Check-column-name-if-existing/m-p/312011/highlight/true#M56...
https://community.jmp.com/t5/Discussions/How-to-check-if-list-of-columns-exist-and-report-those-that...
https://community.jmp.com/t5/Discussions/If-column-exists/td-p/348
https://community.jmp.com/t5/Discussions/how-to-creat-new-column-if-same-name-column-does-not-exist/...
https://community.jmp.com/t5/Discussions/Create-a-new-Row-column-only-if-it-does-not-exist/td-p/3091...
https://community.jmp.com/t5/Discussions/Determining-if-a-column-exists/m-p/6268#M6267
https://community.jmp.com/t5/Discussions/Validate-column-name-exists-before-graphing/m-p/5088#M5087
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:
https://community.jmp.com/t5/Discussions/check-if-column-exists/m-p/572468
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