Page 1 of 1

modify function substring()

Posted: Fri Mar 24, 2006 2:55 pm
by emma
I want to use a modify stage (because I don't want to use transformer) to split a single fixed field in two fields.
Like specifications I have to extract from the input string two strings to the output

record_type:string[1] = substring(record_data,1,1) ;
record_detail:string[255] = substring(record_data,2,255) ;

And I have this message:

Error parsing modify adapter: Error in binding:
Parsing parameters "" for conversion "string=substring [0,0](string)": Expected integer, got: <eof>
Expected destination field selector, got: ")"; input:
record_type:string[1] = substring(record_data,1,1)

Something wrong with the syntax or the modify stage is not capable to accomplish this kind of transformation?

Posted: Sat Mar 25, 2006 5:14 am
by kumar_s
Try
record_type:string[1] = substring[1,1](record_data)

Posted: Mon Mar 27, 2006 10:30 am
by emma
Thanks Kumar_s.

It works if we keep in mind that in Orchestrate environment a string starts with 0 not with 1 like in BASIC.
So, to extract first character must be:
record_type:string[1] = substring[0,1](record_data)

Posted: Tue Mar 28, 2006 9:39 am
by benny.lbs
emma wrote:Thanks Kumar_s.

It works if we keep in mind that in Orchestrate environment a string starts with 0 not with 1 like in BASIC.
So, to extract first character must be:
record_type:string[1] = substring[0,1](record_data)
Just for document, In Transformer, it starts with 1.