Hi, I have a script that does an advanced table concatenation, and I want to add 'source columns' to indicate the original table names. I have a few methods that work but all are slow for large tables. I also tried a formula method but it wasn't quick either. Is there some other trick I can use?
Example below very closely matches what I'm doing. Data table sizes of 1M rows are not unusual, so I'd really like to get this operation down into the low seconds for large tables.
Thanks,
Mike
dt = new table();
dtList = {dt};
rowCount = 50000;
dt << add rows(rowCount);
time2 = today();
if(0,
dt << new column("test", character, set each value(eval(dtList[1]) << get name)); // 24 sec at 50k rows.
,
tempList = {};
for(i = 1, i <= rowCount, i++, tempList[i] = eval(dtList[1]) << get name); //104 sec at 50k rows.
dt << new column("test", character, values(templist));
);
show(eval(today()-time2));