Jump to content
  • 0

Concatenate fields without leading spaces


Question

I want to concatenate values even if the first or second is blank. In such a way that there are no left over spaces if one is null. So I am trying to combine FirstName1 + LastName1 + FirstName2 + LastName2, and if Name 1 is blank, I prefer not to have any leading spaces in my result. Is it possible?

Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

You may try this formula:


CASE WHEN
[@field:FirstName1] = ' '
THEN
IsNull([@field:LastName1], ' ') + ' ' + IsNull([@field:FirstName2], ' ') + ' ' + IsNull([@field:LastName2], ' ')
WHEN
[@field:LastName1] = ' '
THEN
IsNull([@field:FirstName1], ' ') + ' ' + IsNull([@field:FirstName2], ' ') + ' ' + IsNull([@field:LastName2], ' ')
WHEN
[@field:FirstName2] = ' '
THEN
IsNull([@field:FirstName1], ' ') + ' ' + IsNull([@field:LastName1], ' ') + ' ' + IsNull([@field:LastName2], ' ')
WHEN
[@field:LastName2] = ' '
THEN
IsNull([@field:FirstName1], ' ') + ' ' + IsNull([@field:LastName1], ' ') + ' ' + IsNull([@field:FirstName2], ' ')
END

 

Just change the fields that I usedepending on the fields that you are using. I hope that helps you.

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...