Auto Unique Identifiers-Alphanumetical

Actually I was looking for a solution that concatenate few track entity attribute and generate unique identifier. Finally solved the issue by writing a program rule.

In my rule I have concatenated
Unique Identifier code = First letter of Gender + Org unit code + First 2 character of patient name + birth rank + First 2 character of mother name.