Page 1 of 1
Substring from rear
Posted: Tue May 16, 2006 9:42 am
by eldonp
I have 2 jobs, xxxparams and qwertyparams. In a transformer, I create a stage variable, var1 = DSJ.ME and get the name of the jobs - ie xxxparams and qwertyparams.
I need a function that will clip off the 'params' part from the end of the jobname dynamically. Any ideas?
Just to make it clear, I need
var2 = funtion(DSJ.ME,clip off 'params' dynamically) that gives xxx and qwerty respectively.
Posted: Tue May 16, 2006 9:55 am
by DSguru2B
You can use something like this, provided the params always is the suffix and not prefix
Code: Select all
funtion(DSJ.ME,Left(jobname,Index(jobname,"params",1)-1))
I bet others will have a far better solution than me. But try it out.
Posted: Tue May 16, 2006 10:09 am
by ArndW
Var2 = DSJ.ME[1,LEN(DSJ.ME)-7]
Posted: Tue May 16, 2006 10:22 am
by DSguru2B
Nice ArndW.
They should have a thumbs up icon
Posted: Tue May 16, 2006 2:58 pm
by ray.wurlod
Umm... isn't DSJ.ME always set to 1 ?
You would need the DSJobName macro or an appropriate function call in there. This is implied by the jobname reference in the first solution.
Posted: Tue May 16, 2006 3:32 pm
by ArndW
I just realized that it was a mnemonic. Use 2 stage variables, first call to get DSGetJobInfo(DSJ.ME,DSJ.JOBNAME) and second one to get the substring from it. Don't use normal derivations, just initial values so it only gets executed one time.