Hi everyone,
In my code, I open up a csv file, and I rename the column to "Column 1". In the data table, it is renamed, but when I search through all the different columns, it can't find "Column 1". It only recognizes its original name when it is opened. I am searching for values with in a data table, and I need to know what column it is in (which is working if I set i to 2). I know that setting i to 2 would work for this application, but in general, I think it would be good to know why this is happening.
colFunction = Function({search_string},
found =0;
i=1;
Show(search_string);
Show(nCols);
While (found == 0,
match_rows = dt << get rows where(as column(dt, nCols)==search_string);
if(nrows(match_rows) > 0, found = 1, i++);
if(i==nCols, found =1, );
);
col = Num(i);
);
file = Pick File();
dt = Open (file);
for(i=1, i<=ncols(dt), i++,
column(dt,i) << data type(Character);
column(dt,i) << set modeling type(continuous);
);
nCols = dt << Get Column Names ("Character");
col = Column (1);
col << set name("Column 1");
irglCol = colFunction("Irgl");