I have a requirement of mapping single name (with space as delimiter) to FIRST_NAME and LAST_NAME of two different fields in the database view
ex: pipeline input RAHUL CHANDRA pipeline out contains FIRST_NAME
Is there a service to map this scenario suggestions most welcome
see IS BuiltIn-Services reference for further infomrations.
you can use pub.string:tokenize with space as a delimiter and then map first part to first name and second part to last name.
Another option might be to use a combination of substring with indexOf(" ").
I.e. substring(0, indexOf(" “)) and substring(indexOf(” ")+1)
Be aware that both these options only work when there is only one space in the full name.
When either first name or last name (or both) will contain spaces we will have to think further about other options.
Thanks von tokeniz is working fyn and I am using it substring with indexof not working
both services (substring and indexOf) are part of the folder pub.string.
Code outline should look like this:
- pub.string:indexOf (use space character as subString input)
- pub.math:addInt (to add 1 to the index for the second part of the string to omit the space character)
- Map Step with 2 transformers for the service pub.string:substring (using 0 as startIndex and original index as endIndex for the first one and the modified index (incremented by 1) as startIndex for the second one (leave endIndex empty to retrieve the complete rest of the string))