TransformEach can be replaced with a for loop, something like this
// dt_names = Transform Each({dt_ref}, dt_list, Substr(dt_ref << get name, 1, 31));
// for every dt_ref in dt_list, make a new list using substr...
dt_names = {};
for( i = 1, i <=nitems(dt_list), i += 1,
dt_ref = dt_list[i];
insert into( dt_names, substr( dt_ref << get name, 1, 31 ) );
);
Craige