Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Remove characters from a string.

i have a field download having values 111.19kbps , 790kbps and many more.

i want the field to contain only values such as 111.19 , 790 and remove the 'kbps from the end'

i tried using

load

....

KeepChar(Download,'0123456789') as download

....

from ......

as well as

load

....

left(download,3) as download.

....

from ......

but none of those worked

any help would be highly appreciated.

Thanking you guys in advance.

5 Replies
francoiscave
Partner - Creator III
Partner - Creator III

Hi Tausif,

Use the Replace() function. It will be easier.

Replace(Download,'kbps','')

A right() function could be useful too...

François

maxgro
MVP
MVP

keepchar(Download, '.0123456789')

Not applicable
Author

i tried but when i reload it and after displaying the field in list box it is empty.

Replace(Download,'kbps','') as download

Colin-Albert

Your keepchar expression has removed the decimal point. Add the decimal point to the character list.

Keepchar(Download, '0123456789.') as download

The simplest way to test this is to create a Straight Table chart with Download as the dimension and the keepchar example ression as the chart expression. You can then test the expression without the need to reload the data. Once the expression works, copy it to your script.

MarcoWedel

Hi,

you could also load this field as numerical value and still keep the physical unit:

Num#(bitratetxt,'#,###.#kbps') as bitrate

QlikCommunity_Thread_149616_Pic1.JPG

QlikCommunity_Thread_149616_Pic2.JPG

Purging the unit could be done like

Num(Num#(bitratetxt,'#,###.#kbps')) as bitrate2

on the other hand.

table1:

LOAD bitratetxt,

     Num#(bitratetxt,'#,###.#kbps') as bitrate,

     Num(Num#(bitratetxt,'#,###.#kbps')) as bitrate2,

     RecNo() as ID    

Inline [

bitratetxt

111.19kbps

790kbps

1234kbps

1.123kbps

11.23kbps

112.3kbps

0.11234kbps

3456789kbps

3.456789kbps

34.56789kbps

345.6789kbps

3456.789kbps

34567.89kbps

345678.9kbps

];

hope this helps

regards

Marco