Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear Team,
@Richard Hall @Shicong Hong @Xiaodi Shi,
I have these 3 requirement.
Sample data
Mr. Prabhakaran
Mr. Kevin
Mrs. Lindsay
Miss. Pinit
Required Result : ( 1st requirement result )
Mr
Mrs
Miss
Required Result : ( 2nd requirement result )
Prabhakaran
Kevin
Lindsay
Pinit
Required Result: (3rd requirement result )
Rajendran Prabhakaran
Prabuj Kevin
Lohan Lindsay
Julaluk Pinit
Thanks in advance. Please share me with me a clear example , it could help everyone who see the post in future as well as me.
Dear Team @Richard Hall @Shicong Hong @Xiaodi Shi
I have figure out the answer, and love to share the code - so it can be useful to others.
StringHandling.TRIM(row16.Name).split("\\.")[0] for trimming the prefix.
StringHandling.TRIM(row16.Name).split("\\.")[1] for removing the prefix from name
StringHandling.TRIM(row16.Name).split("\\.")[1] + " " + row17.Middle_Name for including first name with middle name.
NOTES: ( WHEN DEALING WITH DOT )
You need to escape the dot if you want to split on a literal dot:
String extensionRemoved = filename.split("\\.")[0];
Otherwise you are splitting on the regex ., which means "any character".
Note the double backslash needed to create a single backslash in the regex.
If You're getting an ArrayIndexOutOfBoundsException because your input string is just a dot, i.e. ".", which is an edge case that produces an empty array when split on dot; split(regex) removes all trailing blanks from the result, but since splitting a dot on a dot leaves only two blanks, after trailing blanks are removed you're left with an empty array.
THANKS FOR ALL THE SUPPORT..!
Hello,
If we understand your requirement very well, you are able to achieve your goal Via tExtractDelimitedFields component.
Extracting a delimited string column (sample data)by setting field separator as "." and then concatenating your 2nd requirement result with the real first name in tMap or Uniting them via tUnite component
Best regards
Sabrina
Hello,
This is a demo job work flow.
Hope it helps
Best regards
Sabrina
Using tExtractDelimitedFields, by using field seperator as "." - it won't collect the result.
Because the components work with comma, colon : , semicolon; as per the talend guide. How you can do it with dot as a field seperator ?????
First name
Mr. Prabhakaranrajendran
How you can concatenate within a column, when it don't produce the result. ? If you concatenate , the 2nd part is the fullname with prefix.
1st requirement is to split the prefix.
2nd requirement is to remove the prefix from name
3rd is to include firstname before middle name. ( Prabhakaran Kuppusamy Rajendran)
Kuppusamy is the middle name.
MY QUERY IS NOT SOLVED. COULD YOU PLEASE HELP OUT (OR) SHOW WHAT YOU HAVE DONE INSIDE TMAP.
@Xiaodi Shi @Shicong Hong @Richard Hall
Using tExtractDelimitedFields, by using field seperator as "." - it won't collect the result.
Because the components work with comma, colon : , semicolon; as per the talend guide. How you can do it with dot as a field seperator ?????
First name ( COLUMN_NAME )
Mr. Prabhakaranrajendran
How you can concatenate within a column, when it don't produce the result. ?
1st requirement is to split the prefix.
2nd requirement is to remove the prefix from name
3rd is to include firstname before middle name. ( Prabhakaran Kuppusamy Rajendran)
Kuppusamy is the middle name.
RESULT FAILED TO SPLIT AS PER YOUR ADVISED.
MY QUERY IS NOT SOLVED. COULD YOU PLEASE HELP OUT (OR) SHOW WHAT YOU HAVE DONE INSIDE TMAP. I FIGURE OUT THE WAY FOR THE 1st requirement in another way , at the end I will share the result.
I WOULD LIKE TO KNOW FOR 2nd & 3rd REQUIREMENT.
Thanks in advance.
Dear Team @Richard Hall @Shicong Hong @Xiaodi Shi
I have figure out the answer, and love to share the code - so it can be useful to others.
StringHandling.TRIM(row16.Name).split("\\.")[0] for trimming the prefix.
StringHandling.TRIM(row16.Name).split("\\.")[1] for removing the prefix from name
StringHandling.TRIM(row16.Name).split("\\.")[1] + " " + row17.Middle_Name for including first name with middle name.
NOTES: ( WHEN DEALING WITH DOT )
You need to escape the dot if you want to split on a literal dot:
String extensionRemoved = filename.split("\\.")[0];
Otherwise you are splitting on the regex ., which means "any character".
Note the double backslash needed to create a single backslash in the regex.
If You're getting an ArrayIndexOutOfBoundsException because your input string is just a dot, i.e. ".", which is an edge case that produces an empty array when split on dot; split(regex) removes all trailing blanks from the result, but since splitting a dot on a dot leaves only two blanks, after trailing blanks are removed you're left with an empty array.
THANKS FOR ALL THE SUPPORT..!