Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Ayoub
Contributor III
Contributor III

Replace multiple char in String

Hello Community 

i have the table bellow and i want to remove those words  'STE' 'SARL' 'SA'  existing in the Start and end of field RAISON_Sociale

i tried 'MapSubString' but in case of the last word 'SA SARLPOK'  the result became POK and i want it to Be 'SARLPOL'

 quest.PNG

Thank you so much for the help 

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Perhaps something like this:
If(Match(SubField([RAISON_SOCIALE],' ',1),'SA','SARL','STE'), Mid([RAISON_SOCIALE],Index([RAISON_SOCIALE],' ')+1),[RAISON_SOCIALE])


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Gysbert_Wassenaar

Perhaps something like this:
If(Match(SubField([RAISON_SOCIALE],' ',1),'SA','SARL','STE'), Mid([RAISON_SOCIALE],Index([RAISON_SOCIALE],' ')+1),[RAISON_SOCIALE])


talk is cheap, supply exceeds demand

View solution in original post

marcus_sommer
MVP & Luminary
MVP & Luminary

I think it might be solvable with mapsubstring by using multiple statements for your adjustments. This means something like to replace 'SARL' at first with an unique char like chr(1) and then checking to chr(1) & 'POK' and replacing it with 'SARLPOK' again and afterwards the chr(1) will be also replaced.

I'm not sure if it could be done within a single mapsubstring - in this case the order of the statements would be important - but with multiple mapsubstrings maybe applied with a chain of preceeding loads it should be possible.

- Marcus

Ayoub
Contributor III
Contributor III
Author

it works  Thank you so Much 

Ayoub
Contributor III
Contributor III
Author

Hey@Gysbert_Wassenaar 

What if i want to delete the same words from the  right side cause this one works only in the left  ? 

thank u for ur heelp

 

Gysbert_Wassenaar

Yes, this one works just from the left. You can do it from the right with this (I hope):

If(Match(SubField([RAISON_SOCIALE],' ',-1),'SA','SARL','STE'), Left([RAISON_SOCIALE],Index([RAISON_SOCIALE],' ',-1)+1),[RAISON_SOCIALE])

talk is cheap, supply exceeds demand