Many ways to handle this. Some examples how to delete _DATA from string
Names Default To Here(1);
str = "FARAH_DATA";
//Word
Show(Word(1, str, "_"));
//Contains and left/substr
Show(Substr(str, 1, Contains(str, "_", -1) - 1));
Show(Left(str, Contains(str, "_", -1) - 1));
//Substitute
Show(Substitute(str, "_DATA", ""));
//Regex
Show(Regex(str, "_DATA", "", GLOBALREPLACE));
Show(Regex(str, "^(.*?)(_DATA)", "\1"));
Using with datatables:
Names Default To Here(1)
dt1 = New Table("Untitled",
Add Rows(4),
New Column("Source",
Character,
"Nominal",
Set Values({"FARAH_DATA", "FARAH_DATA", "FARAH_DATA", "FARAH_DATA"})
)
);
dt2 = New Table("Untitled 2",
Add Rows(3),
New Column("Source",
Character,
"Nominal",
Set Values({"MIKE_DATA", "MIKE_DATA", "MIKE_DATA"})
)
);
dt_list = {dt1, dt2};
//using contains with left
//JMP16, if previous use For-loop
For Each({cur_dt}, dt_list,
Column(cur_dt, "Source") << Set Each Value(Left(:Source, Contains(:Source, "_", -1) - 1));
);
-Jarmo