How To Format Multiple Text Input On A Strring Field?
Today I want to share one of my findings about the Employee Central Rule structure. The case is simple when you have a customer who asks for automatic formatting when users entered a custom text with multiple words into a string field. The field could be the first name field and the format wished is to have the first letter of each input be upper and the rest of the word be lowercase.
Normal rule functions like substring etc. do not support this case so I came up today with a stable and well-functioning resolution to this case. The main struggle here is to detect the space between words so I used the index of() function to do so.
For those who are not familiar with the index of(), it’s a function that counts the characters till it finds the one you wish. In this case, it would be space but since it’s not a character in the usual input language we have to find a relevant as a regular expression which is \s, and convert it to a character which we can see in our function.
I hope the explanation is clear but even that so I think we need to see it in rule structure as follows:
Now we have the number to use in Substring() function to format as asked. After this achievement formatting of a 2 text entered on a string field rule function would be:
The thing here to consider is the index of() function counts space also so you should use the minus() function for better performance.
-Make sure the end-user puts only the alphabetical characters. Validate this as the fist if of your rule:
-End users may enter extra words which wouldn’t be in your scoping like your rule was scoped to format 2 words but users may put 3 words. This kind of case should be validated at the end of the rule with Else condition:
Thanks to the Index of() function we are able to detect the position of the space to use it under the substring function. This allows us to modify the multiple-word entries.
Last but not least, I would appreciate it if you could provide your feedback, and if you have any questions feel free to meet me in the comments. I have just started to share my knowledge on SuccessFactors if you want to hear more follow my profile!
I'm an ABAP developer but I'm interested in learning SuccessFactors.
It's one of my future plans in SAP world. Also it will be good to hear from you about switching SAP career from ABAP to SuccessFactors. I start to track this like informative blogs. Any advices appreciated and thanks again for article.
Your kind feedback is very much appreciated and I'm glad that Successfactors feels interesting to those who are already in SAP environment.
When we are working with Successfactors there are multiple modules to be focused on and I suggest you come up with a specific module to get interested in. I don't know if you are familiar with HR processes but all have an individual module in Successfactors. For example, managing the performance reviews and assessments are being carried out by Successfactors Performance and Goals Management and employee data, and experience on a daily base is in the scope of Successfactors Employee Central. When you come up with something specific as I mentioned best advice would be to navigate the community page to learn about the process and implementation-related topics. You can, for instance, navigate to lhttps://groups.community.sap.com/t5/sap-successfactors-employee/bd-p/employee-central
Thanks again for the kind feedback.
Great article because, that's the solution I was looking for nowadays! 🙂
I have a different situation, some employees' surname is written like "Abc-Xyz". In this situation is your solution will be enough or need to make some revision in your rule?
Thanks in advance.
I'm following you and very excited to see new articles from you.
I'm glad that you found useful the solution above and of course, it covers your other situation the only thing to consider in that case would be to detail your second word format via searching not only the space but also the "-" character in the rule.
All the Best,