Velocity: Multiple name in First Name | Community
Skip to main content
Vidhi_Kare
New Participant
October 12, 2021
Solved

Velocity: Multiple name in First Name

  • October 12, 2021
  • 1 reply
  • 5582 views

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

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman
Just split on space and check the size of the resulting array.

1 reply

SanfordWhiteman
New Participant
October 12, 2021

Why are you referring to character length when what you mean is number of words?

Vidhi_Kare
New Participant
October 12, 2021

Hi Sanford, 

 

Thank you for your reply.

Yes I meant number of words & in this case, all I am concerned about multiple strings in one field.

 

Kind Regards,

Vidhi

 

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
October 12, 2021
Just split on space and check the size of the resulting array.