Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
shane_spencer
Valued Contributor

Trimming unwanted '%' from raw data

I've got dozens of raw files I load each day (see attachment). I've got a script (attached) that processes these in to QVD format. I've got a field in the raw data called Capacity that shows the figure as a percentage (i.e. 25%). I want to trim the '%' sign from this field whenever it occurs. I don't simply want to trim the last character in case it's not a %, so the script must specifically trim '%' signs only from this field. What's the best way to achieve this?

Tags (2)
1 Solution

Accepted Solutions

Re: Trimming unwanted '%' from raw data

Try the PurgeChar() function.

View solution in original post

6 Replies

Re: Trimming unwanted '%' from raw data

Try the PurgeChar() function.

View solution in original post

Re: Trimming unwanted '%' from raw data

The easiest way is, when you load you file (es. gbl05928_filesystem.Sep_04_2014) to do:

Load

...

PurgeChar(Capacity, '%') as capacity

from

...


Let me know

peterwh
Contributor

Re: Trimming unwanted '%' from raw data

Hi Shane,

I would simpy do an "replace(Capacity, '%', '') AS Capacity". Maybe this helps already

Kind regards

Peter

shane_spencer
Valued Contributor

Re: Trimming unwanted '%' from raw data

That's perfect - assumed there would be an easy answer, it's just about knowing what that answer is.

PurgeChar(Capacity, '%') as Capacity%

Re: Trimming unwanted '%' from raw data

Yup - It's all there in the QV Desktop Help, but as always the Catch 22 is that it is only easy to find as long as you already know the answer.

shane_spencer
Valued Contributor

Re: Re: Trimming unwanted '%' from raw data

Thank you Peter Hübschen the "replace" function came in very handy for updating the last 7 months worth of processed data in 1 easy swoop! i.e.

LOAD Date,

    Server,

    Hour,

    Minute,

    Main_metric,

    replace(sub_Metric, 'Capacity', 'Capacity%') AS sub_Metric ,

    replace(value, '%', '') AS value