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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Remove part of a string

Hi

I have a addressfield that include specific apartment-ID. I would like to remove the nr/id in the script.

The addresses can look like this.

Mainstreet 43 D lgh 2005  - remove D lgh 2005

Walkingstreet 9 lgh 105    - remove lgh 105

Littlestreet 10a, lgh 100    - remove a, lgh 100

Main littlestreet 240-10     - remove -10

Littlestreeet 52                  - don´t remove anything

Little mainstreet 12          - don´t remove anything

Hope you understand, I would like to keep the streetname and streetnr

14 Replies
tresesco
MVP
MVP

Hope that somebody can suggest a simpler way, by then the following works (Assuming, you have three digit street number at max):

Load

          Left (Address, RangeMax(findOneOf(Address, '0123456789'), If(FindOneOf(Address, '0123456789' ,2) - FindOneOf(Address, '0123456789') =1, If(FindOneOf(Address,'0123456789', 3) - findOneOf(Address, '0123456789',2)))))

AS NesAddress

From <>;

Not applicable
Author

This is truly awesome. gone for a hour and so many tips! I will start testing, thank you all!

Not applicable
Author

hi

try this hope this helps you.

SubField(Name,' ',1 ) & ' ' & if(SubStringCount(Name,' ') <=2, subfield(Name, ' ' ,2) &' '& subfield(Name, ' ' ,3),subfield(Name, ' ' ,2))  as Address;

Not applicable
Author

seems to do the trick!

Not applicable
Author

Hi Hofstedt ,

PFA.

hope this may help u