Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

string to integer?

Hi,

I have a field 'space used'. This is either in MB or GB.

data looks like this:

3123MB

10GB

1400MB

12GB

I want to display the entire column in terms of GB. So i have to convert my MB data to GB. Just dividing by 1024 doesnt work since Qlikview considers this to be a string.

How can i do this?

1 Solution

Accepted Solutions

Re: string to integer?

How about:

=alt(num#(F1, '0MB')/1024

  ,num#(F1, '0GB')+0

  , F1)

-Rob

http://robwunderlich.com

5 Replies
MVP
MVP

string to integer?

Hi,

this should help:

data:

LOAD * INLINE [

    F1

    3123MB

    10GB

    1400MB

    12GB

];

result:

load if(right(F1,2)='MB', Num#(Mid(F1, 1, Len(F1)-2))/1024, Num#(Mid(F1, 1, Len(F1)-2))) as [space used]

Resident data;

- Ralf

Not applicable

string to integer?

Hi Ralf,

So i was hoping to change this in the expressions column of the graph. How should i enter this in the IF statement?

This is what i am working with right now:

if (wildmatch (space_used = '*MB')>0), space_used * (1/1024), space_used)

so this says that is you find MB then divide by 1024 else display as it is.

Not applicable

string to integer?

even this doesnt work: if(wildmatch(gp_rss_ram,'*M')>0, (Len(gp_rss_ram)-2)*(1/1024),gp_rss_ram)

Re: string to integer?

How about:

=alt(num#(F1, '0MB')/1024

  ,num#(F1, '0GB')+0

  , F1)

-Rob

http://robwunderlich.com

Not applicable

string to integer?

This worked: if(wildmatch(gp_rss_ram,'*M')>0,num#(gp_rss_ram, '#M')/1024,num#(gp_rss_ram,'#G'))

Community Browser