Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
daisy1438
Contributor III
Contributor III

how to remove string values in a field?

Hi

I have one field like below it showing numbers and string values.so if requirement keep string in a field remove numbers or if requirement keep numbers  remove strings.how?

data:

1203

4567

OBALT

OBALT

9200

3456

22334

OEUROPE

OEUROPE

like that.

data is field name.

Thanks

daisy

10 Replies
m_woolf
Master II
Master II

To delete the records where Data is a string:

load

     *

from whatever

where num(Date) > 0

To delete the value of Data when is a string:

load

     *,

     if(num(Data) > 0,Data) as Data 1

from Whatever;

drop field Data

rename field Data1 to Data;

swuehl
MVP
MVP

You can use IsNum() function to check if the field value is a number:

LOAD data

FROM ...

WHERE IsNum(data);

or for text values:

LOAD data

FROM ...

WHERE NOT IsNum(data);

shiveshsingh
Master
Master

T:LOAD * INLINE [

 

   data

1203

4567

OBALT

OBALT

9200

3456

22334

OEUROPE

OEUROPE

] where  IsNum(data);

Akina0929
Creator
Creator

Hi,

use following expressions.

=purgechar(data,0,1,2,3,4,5,6,7,8,9)  >>it Removes number from field.

=purgechar(data,'put all strings in single quote which you want to Remove')  >> it Removes strings from the fields.

Regards

Anji

daisy1438
Contributor III
Contributor III
Author

thanks it working.

daisy1438
Contributor III
Contributor III
Author

Hi above function is working fine.

and some times my fields show another values also how to remove that.

input:                   output:

field                      Field

123                       UK

111                       US

UK

Us

-

-

Missing

Missing

 

it means while loading time remove null values and missing and numbers.

shiveshsingh
Master
Master

Yes, you can filter it if you don't require, during loading.

shiveshsingh
Master
Master

Please close the thread

swuehl
MVP
MVP

Just combine multiple conditions in your WHERE clause using boolean operators:

LOAD data

FROM ...

WHERE

     NOT IsNum(data)

          AND

     Len(Trim(data)) // NULL will return zero / false here

          AND

     data <> 'Missing'

;