Page 1 of 1

Substring extraction

Posted: Thu Sep 06, 2007 4:48 am
by elavenil
Trying to extract 1st 2 chars from a string but the job got aborted with the error message "Error parsing modify adapter: Error in binding: Expected source field selector; got: "20070705"
Expected destination field selector, got: ")"; input:"
and the code that is applied in Modify stage, is below.

MISTR:string[2] = substring[1,2] (#BIZDATE#), where BIZDATE is the parameter and '20070705' was passed while executing the job.

Let me know what is wrong and whether parameter can be used in the derivation.

Thanks
Elavenil

Posted: Thu Sep 06, 2007 7:56 am
by chulett
Check your substring syntax in the online help or pdf documentation.

Posted: Thu Sep 06, 2007 9:03 am
by JoshGeorge
Substring syntax looks alrite for me.
OutputField=substring [startPosition,len] (InputField)
or is this not the right syntax? :roll: Passing job parameter into that syntax can be the issue?

Posted: Thu Sep 06, 2007 9:23 am
by gateleys
JoshGeorge wrote:Substring syntax looks alrite for me.
OutputField=substring [startPosition,len] (InputField)
or is this not the right syntax? :roll: Passing job parameter into that syntax can be the issue?
Check the type of your parameter in its definition. May be it is other than a string.

Posted: Thu Sep 06, 2007 9:29 am
by Abburi
gateleys wrote:
JoshGeorge wrote:Substring syntax looks alrite for me.
OutputField=substring [startPosition,len] (InputField)
or is this not the right syntax? :roll: Passing job parameter into that syntax can be the issue?
Check the type of your parameter in its definition. May be it is other than a string.
Use the square brackets. They are perfectly viable solution for substrings in both server and parallel editions

More you can find from below link, which DSguru2B has posted.

viewtopic.php?t=111106&highlight=substring

Posted: Thu Sep 06, 2007 4:22 pm
by ray.wurlod
Abburi, you are thinking of the Transformer stage, not the Modify stage.

Elavenil, in another post I discussed the inviability of using job parameters in Modify stage.
Note also that the Modify stage positional argument is zero based, therefore the first two characters in a string are 0 and 1. So you would need

Code: Select all

MISTR:string[2] = substring[0,2](BIZDATE) 
where BIZDATE is the name of the input column generated upstream from the Modify stage, using a job parameter reference perhaps in a Column Generator stage.

Posted: Thu Sep 06, 2007 6:16 pm
by JoshGeorge
Yeah, modify stage dosen't like job parameter substituted in its operator calls.
JoshGeorge wrote:Substring syntax looks alrite for me.
OutputField=substring [startPosition,len] (InputField)
or is this not the right syntax? :roll: Passing job parameter into that syntax can be the issue?[/quote]