In talend Open Studio if I have a context variable which points to a directory C:/MyData
how can I subtract that from a directory string e.g. C:/MyData/Folder/Sub/
so that I end up with /Folder/Sub/
for additional processing
I tried storing the C:/MyData/Folder/Sub/
in a variable Path
and the context as as string in tMap use Var.Path.replace(Var.ContextAsString, "")
but that didn't affect the output at all
Are there better ways to manipulate strings that represent directory paths using Talend tMap?
No need to declare a tMap variable. Suppose the field containing the full path is "row1.fullpath" and the context variable is called root (containing "D:/MyData"). On the right part of the tMap, just write:
row1.fullpath.replace(context.root, "")