This is what I want! However when I try to put this in my script it is crashing. The values I used in my example (TEST_BOUROUGH_GENDER) are not real due to IP issues but mearly are used as an example. Also after the last delimiter "_" the column will either start M or P. Is there a way with startswith function to include two seperate characters it can start with?
allColNames = dt << getcolumnnames;
pulledCols = {};
Ncols = N items(allColNames);
for(i = 1, i <= Ncols, i++,
cname = Column(allColNames[i]) << get Name;
if(startswith(Word(5,cname , "_"),"M"),
Column(cname) << set name(
Word(1, cname, "_") || "_"|| Word(2, cname, "_") || "_" || Word(3, cname, "_") || "_" || Word(4, cname, "_") ||"_ALL_" || Word(5,cname,"_")
)
),
if(startswith(Word(5,cname , "_"),"P"),
Column(cname) << set name(
Word(1, cname, "_") || "_"|| Word(2, cname, "_") || "_" || Word(3, cname, "_") || "_" || Word(4, cname, "_") ||"_ALL_" || Word(5,cname,"_")
)
)
);