SOLVED

Velocity: Multiple name in First Name

Go to solution
Vidhi_Kare
Level 3

Hi all,

Hope you are doing well.

I am trying to solve one problem using Velocity to Display " Hi Member" instead of Name  in First Name field when it consists of multiple names. 

Example : Rodney William Hydes

I was thinking to use length check but we don't know the max chars that can be input in this field. So if it is just one input and length is more than 2 then I have used the code to display the name by taking the index at 0.

However, it seems like I would need another condition when length is greater than 2 and then find a solution to display Hi Member instead of name if its not in one string.

Any inputs will be appreciated. Hope it is not confusing.

 

Kind Regards,

Vidhi

 

Tags (1)
1 ACCEPTED SOLUTION
SanfordWhiteman
Level 10 - Community Moderator
Just split on space and check the size of the resulting array.

View solution in original post

21 REPLIES 21
Jo_Pitts1
Level 10 - Community Advisor

Nice thinking.

It does also achieve my suggestion - namely giving you an element of the array you can use for the first name if you wanted to not exclude, but actually display something meaningful (and it works for those with only a single first name as well).