I'm trying to take a data table and add a column with a formula that sums all columns that contain the string "ToAdd" in the column name. I'm trying to script this because the columns that will have "ToAdd" somewhere in the name will change.
So far, I have the script that can collect all the column names into a list, but I'm not sure how to then use that list to generate a new column with a formula that sums all those columns together. This seemed like the best way to start, but not sure where to go from here (or if it really is a good way to start)
dt = current data table();
N = N Col( dt );
AddColumns = {};
For( i=1, i <= N, i++,
colname = Column(i) << getname();
If( Contains( colname, "ToAdd") > 1,
Insert Into(AddColumns, colname )
);
)
);
Thanks for any help in advance!