Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
i was trying out a scenario of splitting of name into first,middle and last name accordingly...
as per my testcase... it worked perfectly with "hello world abc!".
but when i try with any other testcast it fails...
for example :
"Sudhansu Sekhar Dash" or "Amiya Prasad Mishra"
the result i get is
"har Dash" or "ishra"
the method used in tmap is ->
StringHandling.RIGHT(row1.ename,StringHandling.INDEX(row1.ename," "))... Pls can anyone help on this....
Job_View
Tmap_view
Capturing first_name from emp name
Capturing last name using "hello world abc!"
Capturing last name from emp name
end result of all names...but issue with capturing last name.
Hi,
I have given a solution for a similar query in another post. Could you please check it and try in your use case with necessary changes?
If the answer has helped you, could you please mark the topic as resolved? Kudos are also welcome 🙂
Warm Regards,
Nikhil Thampi
Hi,
I have given a solution for a similar query in another post. Could you please check it and try in your use case with necessary changes?
If the answer has helped you, could you please mark the topic as resolved? Kudos are also welcome 🙂
Warm Regards,
Nikhil Thampi
hi @nthampi,
greetings of the day,
i have tried the one you have suggested... and it is also giving me the same output...
so can you gimme any other method... for which i might be able to achieve..
thanks in advance
hi @TRF,
greetings of the day,
i have tried giving split method,... but i see there are some issues...
i shall share a screenshot of it..
for example my testcase is
"hello world abc!" -> how would the split method work.... i have considered the case where the method takes single and 2 different arguments.. in single argument method.. i have passed the delimiter by which the name must be split. Note: Should i consider String[](String array), if yes how??
on passing the 2 argument method.... String delimiter and integer.. but this as welll.. failed...
can you pls help.. or suggest something..
thanks in advance
This is what your tMap should look like:
Based on this data sample:
Sudhansu Sekhar Dash Amiya Prasad Mishra Sudhansu Sekhar Amiya
This is the result:
[statistics] connecting to socket on port 3740 [statistics] connected .--------------------+---------+----------+--------. | tLogRow_6 | |=-------------------+---------+----------+-------=| |fullName |firstname|middlename|lastname| |=-------------------+---------+----------+-------=| |Sudhansu Sekhar Dash|Sudhansu |Sekhar |Dash | |Amiya Prasad Mishra |Amiya |Prasad |Mishra | |Sudhansu Sekhar |Sudhansu |Sekhar |null | |Amiya |Amiya |null |null | '--------------------+---------+----------+--------' [statistics] disconnected
hi @TRF,
thanks for your in-detail solution...
but i have one final query -> as we are using split method.... is it always necessary for me to define an object and then the respective indexes of 0,1 and so on must be given across the columns
thanks again....
The Object is here to avoid to have as many String.split() as substrings you have to extract.
I used an Object because it's not possible to declare a variable as a String array.
And finally, yes, you must use indices to get each part of the fullname.
Also, if you have a fullname composed of 2 parts and you want to consider this case as firstName and lastName but not middleName, you must have a double space in the middle (for example, "Sudhansu Dash").
In this case the middleName will contains an empty string, not a null value but it is not difficult to deal with this situation.