Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
Not applicable

String manipulation

Hi all!

I have decoded what a user searches for, from an url adress in a large logfile. The result looks like this:

Skjermbilde.PNG.png

As you can see: space='%20' and the 'ø' char='%C3%B8' and so forth.

Is there an easier way to do this than replace() for each code I want to replace?

best regards

Trond Erik

3 Replies
MVP
MVP

Re: String manipulation

Look into the mapping functions,especially the mapsubstring function:

The MapSubstring function is used to map parts of any expression to a previously loaded mapping table. The mapping is case sensitive and non-iterative and substrings are mapped from left to right. The syntax is:

mapsubstring('mapname', expr)

This function can be used for mapping parts of any expression on a previously loaded mapping table. The mapping is case sensitive and non-recursive. The substrings are mapped from the left to the right. Mapname is the name of a mapping table previously read by a mapping load or a mapping select statement (see Mapping). The name must be enclosed by single straight quotation marks. Expr is the expression whose result should be mapped by substrings.

Examples:

// Assume the following mapping table:

map1:

mapping load * inline [

x, y

1, <one>

aa, XYZ

x, b ] ;

MapSubstring ('map1', 'A123') returns 'A<one>23'

MapSubstring ('map1', 'baaar') returns 'bXYZar'

MapSubstring ('map1', 'xaa1') returns 'bXYZ<one>'

Not applicable

Re: String manipulation

Thank you! Just what I needed.

This community never dissapoints

MVP & Luminary
MVP & Luminary

Re: String manipulation

Hi Trond Erik,

I think it could be useful to load the whole W3 reference:

URL_Encoding_Reference:

LOAD

     Text([URL-encoding]) as URL_encoding,

     Replace([ASCII Character], 'space', ' ') as ASCII_Character

FROM

[http://www.w3schools.com/tags/ref_urlencode.asp]

(html, utf8, embedded labels, table is @1);

..store it as QVD and use it as MAPPING LOAD later for MapSubstr().

- Ralf