I have a script that adds a few columns into data table and creates some charts. The first time I run the script I want to create the new columns, but I want to be able to run the script again on a data table that already has the added columns and just creates the charts. I'm imagining an "IF" statement that checks if a certain column is present or counts the number of columns in the table. Can anybody show me how to do either of those things and/or a different way to script what I am looking for?
This is (thankfully) pretty easy in JMP. You can have all of the column names sent to a list.
The script below grabs the names of the columns in a table. Then it checks if a user-supplied list of column names is present in the table - if the column name is present, a message is written to the log window. It doesn't take too much imagination to see that if the new column name is not present in the table, the IF() condition in the For loop is changed so that the new column is created.