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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dropping text from a string

Hi ... I want to load the below field, 'SALES_NUMBER', but excluding the string 'AB' wherever it exists.

222100

223190

AB224190

AB225190

So output should be :

222100

223190

224190

225190

1 Solution

Accepted Solutions
sunny_talwar

Try

KeepChar(SALES_NUMBER, '0123456789') as SALES_NUMBER

KeepChar() is the function, misspelled it intially

View solution in original post

12 Replies
sunny_talwar

Try

KeepChar(SALES_NUMBER, '0123456789') as SALES_NUMBER

KeepChar() is the function, misspelled it intially

arulsettu
Master III
Master III

if you want only numbers try this

keepchar(SALES_NUMBER,'0123456789')

Anonymous
Not applicable
Author

use KeepChar() instead of KeepChart() as suggested by Sunny

sunny_talwar

Hahahaha I don't see KeepChart()

Just kidding, I saw my mistake and fixed it

Anonymous
Not applicable
Author

or try like this at script level, if it is in fixed format:

if(istext(mid(SalesField),1,2), mid(SalesField,3,len(SalesField)), SalesField) as SalesField

robert_mika
Master III
Master III

OR

PurgeChar('AB224190','AB')

Feeling Qlikngry?

How To /Missing Manual(23 articles)

Anonymous
Not applicable
Author

I was also kidding, Becoz I knew that before putting my comment for you, you would have been updated that

its_anandrjs
Champion III
Champion III

Try this way also

LOAD *,PurgeChar(COLA,'ABCDEFGHIJKLMNOPQRSTUVWXYZ') AS KleenField;

LOAD * Inline

[

COLA

222100

223190

AB224190

AB225190

];

Capture3.PNG

Regards

Anand

Not applicable
Author

Thank you all. I used the first solution ie the keepchar function and it worked nicely.

What if now however I only wanted to pick up values which included the AB string ? So my output would return only the following :

AB224190

AB225190