If I have a list of column literal references, how can I convert them to a list of the string names? Can it be done directly without subsetting the columns first?
col_names = {:Column 1, :"Y (%)"n, :"Quotes \!":name\!""n, :group}
If the 4 column names you are specifying are the complete list of columns in the data table, the easiest way to turn them into a list is
col_names = current data table() << get column names( string );
The "string" argument tells the function to place each column name into the list as a literal string.
See the Scripting Index for a more complete list of arguments and examples
Getting the directly in correct format is often the easiest option (like Jim did show). You can also convert the list for example by using Transform Each and << Get Name.
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(0),
Compress File When Saved(1),
New Column("Column 1", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("Y (%)", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("Quotes \!":name\!"", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("group", Numeric, "Continuous", Format("Best", 12), Set Values([]))
);
col_names = {:Column 1, :"Y (%)"n, :"Quotes \!":name\!""n, :group};
col_names_str = Transform Each({col_name}, col_names, col_name << get name);
Agree, this would be a nice option if we subset those columns into a private temp table say