Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
singhcv123
Contributor
Contributor

remove space while concatenating more than 2 fields...

Hi,

TRIM([ Title]) & ' ' & TRIM(Initials) & ' ' &TRIM([ Name])

as per above concatenation we are facing space issue while 1 of the field is missing like Title or Initials.

LIke examle :

Alex D voyger    ---------this is right out come.

but if some one who don;t have either title or initial than coming doule space instead of single spcae.

Like ::::Without title 

'  D cow'

Like :: without intital

"Mr  Tad"         double space between title and name ...

please suggest.

Labels (1)
6 Replies
Digvijay_Singh
MVP
MVP

Use something like this -


TRIM([ Title]) & if(len(Title)>0,' ') & TRIM(Initials) & if(len(Initials)>0,' ')&TRIM([ Name])

tamilarasu
Champion
Champion

Hi Virendra ,

Simply try,


Replace( [ Title] & ' ' & Initials & ' ' & [ Name] , '  ' , ' ' )

jagan
Partner - Champion III
Partner - Champion III

Hi,

Simply use Replace() to convert two spaces to single space like below

Replace([ Title] & ' ' & Initials & ' ' & [ Name] , '  ', '')

Replace([ Title] & ' ' & Initials & ' ' & [ Name] , 'Give double space here', 'Single space')


Regards,

jagan.


avinashelite
MVP
MVP

try like this

replace(filed1&filed2&filed3,' ','')

Anonymous
Not applicable

Hi, try this:

Trim(Replace(TRIM([ Title]) & ' ' & TRIM(Initials) & ' ' &TRIM([ Name]),'  ',' '))


You will remove start space and double spaces.


Regards!

sunny_talwar
MVP
MVP

Very Nice jagan‌ and others. Thanks for sharing this