☐ 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/If-column-exists/td-p/348
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.