Page 1 of 1

cut up string

Posted: Mon Oct 08, 2007 2:14 am
by ziedkhouja
Hi Everybody,

I want to cut up a string displayed in 38 characters into three parts
8,10 and 10
what i can use as transformations to do this

Thank you very much.

Posted: Mon Oct 08, 2007 4:30 am
by ray.wurlod
Welcome aboard.
8 + 10 + 10 is only 28; what do you want to do with the other ten characters?
You can use the Left(string,n) function to get the leftmost n characters from a string, the Right(string,n) function to get the rightmost n characters from a string, and Substrings(string,start,length) or - equivalently - string[start,length] to extract an arbitrary substring.

Posted: Mon Oct 08, 2007 5:18 am
by ziedkhouja
Sorry 8,10,10 and 10 characters
I try the syntax string [ [ start, ] length ]
but i receive an error:

Compiling: Source = 'RT_BP15/JOB.427335405.DT.1452632587.TRANS1', Object = 'RT_BP15.O/JOB.427335405.DT.1452632587.TRANS1'
**********************************************************************************************************************
WARNING: Variable 'substring' never assigned a value.

Compilation Complete.
(Simulation1.Transformer_4)

Posted: Mon Oct 08, 2007 5:59 am
by JoshGeorge
Check your syntax:

Code: Select all

string [ start, length ]
ziedkhouja wrote: I try the syntax string [ [ start, ] length ]

Posted: Mon Oct 08, 2007 2:36 pm
by ray.wurlod
The name of the function is Substrings (with a final "s"). You left this off, so DataStage is looking for a variable called Substring.