Qlik Community

Community Corner

Discussion board for questions about the Qlik Community, its features, sharing information, general discussions and even some fun. This is for both new and longtime community members. Everyone is welcome!

Announcements
Attend QlikWorld 2020 and hear keynote speaker, Malcolm Gladwell. Register by February 29th to save $200. Learn More
Highlighted
geogou1973
Contributor

Remove some strings from a field

Hello,

I have a field that is the document number of the invoice.

This field will have some strings like . or / or - or etc

how can i remove from all data these strings that have come from false data entry.

I tried with the the following command

IF(FINDONEOF(DOC_PURCHASES,'.'),REPLACE(DOC_PURCHASES,'.',''),
IF(FINDONEOF(DOC_PURCHASES,'/'),REPLACE(DOC_PURCHASES,'/',''),
IF(FINDONEOF(DOC_PURCHASES,'-'),REPLACE(DOC_PURCHASES,'-',''),
IF(FINDONEOF(DOC_PURCHASES,','),REPLACE(DOC_PURCHASES,',',''),
DOC_PURCHASES))))

but in some values does not work and i don't know why.

Have anyone an idea how can i do this.

Thank you in advance.

 

Labels (1)
1 Solution

Accepted Solutions
Highlighted
Frank_Hartmann
Honored Contributor II

Re: Remove some strings from a field

what if you try using purgecharacter function?

purgechar(DOC_PURCHASES,'.-/')

View solution in original post

2 Replies
Highlighted
Frank_Hartmann
Honored Contributor II

Re: Remove some strings from a field

what if you try using purgecharacter function?

purgechar(DOC_PURCHASES,'.-/')

View solution in original post

Highlighted

Re: Remove some strings from a field

As @Frank_Hartmann  suggested you can either use purgechar function in which you can write as many junk characters that you want to remove. If single quotes itself is one of the junk character then you can use it like below

=PurgeChar(DOC_PURCHASES,chr(39)&'-.,')

If you field always going to have number value then you can use keepchar function which will automatically remove all other characters from field

Keepchar(DOC_PURCHASES,'0123456789')