Referencing a selected column in a new column formula
Apr 9, 2020 1:32 PM(478 views)
I am constantly needing to convert Date:Time columns (M/D/Y hh:mm:ss) to date columns and am looking for a script I can add in as a tool such that I can select the Date:Time column I am wanting to use (regardless of the name of the column) to make a new date column and have the script saved into an easy to access shortcut.
The part I am not able to figure out is how I can reference a "selected column" in the new column formula... I feel it should be along the lines of what I have below, except in the formula I am not currently able to figure out how to reference the selected column.
dt1 = Current Data Table();
sc1 = dt1 << Get Selected Columns;
dt1<<new column("Date", Numeric, set each value("SC1" - time of day("SC1")));
In my current data table the Date:Time column is named DviStartTime and is in the format (m/d/y hh:mm:ss), I want to add a new column named date without having to specify the exact name of the column.