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

saving list of cols created by text to column

What inspired this wish list request? 

Multiple file import and open functions are able to save a list of files they open in a list. I'd like to see something similar with functions that can generate multiple columns from one, mainly text to columns 

 

What is the improvement you would like to see? 

 

saving text to column to a variable saves a list of column names generated to a list.

 

Example: A dt containing a column of numbers separated by commas

new_cols_list = dt << Text to Columns( columns( :Numbers column ), Delimiters( "," ) );

 

Why is this idea important? 

This would allow more compact identification of generated columns, and therefore more streamlined, and less error-prone way of working with these columns, if needed

 

2 Comments
jthi
Super User

It is fairly easy to check which columns were created, but it would still be useful if Text To Columns did just return the list of just generated new columns (names/references or maybe work in similar manner as << Get Column Names where user can decide?). And if no columns are returned just return empty list

 

Example how newly created columns can be checked (similar method can be used during table or window creation too). The returned list will be ordered in alphabetical order due to usage of associative array

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Consumer Preferences.jmp");
old_cols = Associative Array(dt << Get Column Names("String"));
dt << Text To Columns(
	delimiter(","),
	columns(:Brush Delimited),
	Make Indicator Columns(1)
);
new_cols = Associative Array(dt << Get Column Names("String"));
new_cols << Remove(old_cols);
new_cols_list = new_cols << get keys;
StarfruitBob
Level VI

I was doing something very similar to what you describe, but thought "there must be a simpler" way"!