picking some part from the string
Moderators: chulett, rschirm, roy
picking some part from the string
Hi All
I have a requirement that from a particular string "The Customer has recently made an application for a new account" I need to pass the value into 2 different columns. Now the issue is in the first column is of 20 length and second column is of 150 length. when I am taking the first 20 characters from the source string the target column will be populated with the value"The Customer has rec". But I want the first column to be popualted with "The Customer has" and the second column should start/load with "recently made an application for a new account".
Can you please advise how we can acheive this.
Thanks in advance
Regards
skumar
I have a requirement that from a particular string "The Customer has recently made an application for a new account" I need to pass the value into 2 different columns. Now the issue is in the first column is of 20 length and second column is of 150 length. when I am taking the first 20 characters from the source string the target column will be populated with the value"The Customer has rec". But I want the first column to be popualted with "The Customer has" and the second column should start/load with "recently made an application for a new account".
Can you please advise how we can acheive this.
Thanks in advance
Regards
skumar
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
Create a stage variable, svBreak, with the following:
Then your column derivations will be:
Col1
Col2
Code: Select all
Index(link.InputString, " ", Count(link.InputString[1,20], " ") )
Col1
Code: Select all
link.InputString[1, svBreak -1]
Code: Select all
link.InputString[svBreak,150]
Last edited by robjones on Wed Oct 07, 2009 6:41 am, edited 1 time in total.
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Premium Member
- Posts: 425
- Joined: Sat Nov 19, 2005 9:26 am
- Location: New York City
- Contact:
Stage Variables
sv1 = InputOrigString[1,20]
LastSv1Char = sv1[1]
sv2 = InputOrigString[21, ( len(InputOrigString) + 1)]
LastSv2Char =sv2[1,1]
svCountSpaces = count(sv1, " ")
svPosition = Index (InputOrigString, " ", svCountSpaces)
Columns derivations
targetCol1= If ( LastSv1Char <> " " and LastSv2Char <> " " ) Then InputOrigString[1, (svPosition - 1)] Else sv1
targetCol2= If ( LastSv1Char <> " " and LastSv2Char <> " " ) Then InputOrigString[svPosition, ( len(InputOrigString) - svPosition )] Else sv2
sv1 = InputOrigString[1,20]
LastSv1Char = sv1[1]
sv2 = InputOrigString[21, ( len(InputOrigString) + 1)]
LastSv2Char =sv2[1,1]
svCountSpaces = count(sv1, " ")
svPosition = Index (InputOrigString, " ", svCountSpaces)
Columns derivations
targetCol1= If ( LastSv1Char <> " " and LastSv2Char <> " " ) Then InputOrigString[1, (svPosition - 1)] Else sv1
targetCol2= If ( LastSv1Char <> " " and LastSv2Char <> " " ) Then InputOrigString[svPosition, ( len(InputOrigString) - svPosition )] Else sv2
Julio Rodriguez
ETL Developer by choice
"Sure we have lots of reasons for being rude - But no excuses
ETL Developer by choice
"Sure we have lots of reasons for being rude - But no excuses