21.01.2013 Views

QlikView Reference Manual.pdf - QlikCommunity - QlikView

QlikView Reference Manual.pdf - QlikCommunity - QlikView

QlikView Reference Manual.pdf - QlikCommunity - QlikView

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Example:<br />

Returns the number of times the string substring appears within the string text. The result is an<br />

integer. If there is no match, 0 is returned<br />

substringcount ( 'abcdefgcdxyz', 'cd' ) returns 2<br />

applycodepage(text, codepage)<br />

Applies a different codepage to the field or text stated in the expression. The codepage must be in<br />

number format.<br />

Back to Other Functions.<br />

Mapping Functions<br />

The ApplyMap function is used for mapping any expression to a previously loaded mapping table. The syntax<br />

is:<br />

applymap('mapname', expr [ , defaultexpr ] )<br />

where:<br />

mapname is the name of a mapping table that has previously been created through the mapping load or the<br />

mapping select statement (see Mapping (page 253)). Its name must be enclosed by single, straight Quotation<br />

Marks (page 281).<br />

expr is the expression, the result of which should be mapped.<br />

defaultexpr is an optional expression which will be used as a default mapping value if the mapping table<br />

does not contain a matching value for expr. If no default value is given, the value of expr will be returned as<br />

is.<br />

Examples:<br />

// Assume the following mapping table:<br />

map1:<br />

mapping load * inline [<br />

x, y<br />

1, one<br />

2, two<br />

3, three ] ;<br />

ApplyMap ('map1', 2 ) returns ' two'<br />

ApplyMap ('map1', 4 ) returns 4<br />

ApplyMap ('map1', 5, 'xxx') returns 'xxx'<br />

ApplyMap ('map1', 1, 'xxx') returns 'one'<br />

ApplyMap ('map1', 5, null( ) ) returns NULL<br />

ApplyMap ('map1', 3, null( ) ) returns 'three'<br />

The MapSubstring function is used to map parts of any expression to a previously loaded mapping table.<br />

The mapping is case sensitive and non-iterative and substrings are mapped from left to right. The syntax is:<br />

mapsubstring('mapname', expr)<br />

325

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!