cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Choose Language Hide Translation Bar
Script to Insert Column(s) into the Middle of a Table
jay_holavarri
Level III

Finally checked to see if someone had already posted something like this and didn't see it. It's an irritant to me (maybe not a rational one) that you have to use >Cols > Add Multiple Columns... dialog to simply add a column in the middle of a table. This script mimics Excel's long-time approach: select a number of columns, click a command to insert that same number of columns adjacent to the selected columns.

I have this script pegged in my Cols menu (via the menu customization tool).

dt=current datatable();

col=dt<<get selected columns;

nc=nitems(col);

dt<<add multiple columns("boo",nc,after(col[nc]),character);