Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

substring in qlikview?

Hello,

Is there a way to catch string in value of a field, like substr in SQL?

I would like to catch et text between "from" and "to" of values from "type" field

Example :

Status Changes From Affected to resolved

i would like only Affected, between from and To

Load

  type as TYPE

From

[\\s-vm-qvw-01\SM7\activity_GCE_RS.qvd]

(qvd) ;

Any idea for helping me?

stephane

Tags (1)
1 Solution

Accepted Solutions
nagaiank
Valued Contributor III

Re: substring in qlikview?

The string function 'mid' has features similar to SQL substring function. An extract from the Qlikview Reference manual is below:

mid( s , n1 [ , n2 ] )

Substring of the string s. The result is the string starting at character n1 with the length of n2 characters. If n2 is omitted, the function returns the rightmost part of the string starting at character n1. The positions in the string are numbered from 1 and up.

Examples:

mid('abcdef',3 ) returns 'cdef'.

mid('abcdef',3, 2 ) returns 'cd'.

mid( Date,3 ) where Date = 970714 returns 0714

mid( Date,3,2 ) where Date = 970714 returns 07

For a more complicated example, see the index function.

3 Replies
jason_michaelid
Honored Contributor II

Re: substring in qlikview?

TextBetween(type,'From ',' to ')     AS     TYPE

Hope this helps,

Jason

nagaiank
Valued Contributor III

Re: substring in qlikview?

The string function 'mid' has features similar to SQL substring function. An extract from the Qlikview Reference manual is below:

mid( s , n1 [ , n2 ] )

Substring of the string s. The result is the string starting at character n1 with the length of n2 characters. If n2 is omitted, the function returns the rightmost part of the string starting at character n1. The positions in the string are numbered from 1 and up.

Examples:

mid('abcdef',3 ) returns 'cdef'.

mid('abcdef',3, 2 ) returns 'cd'.

mid( Date,3 ) where Date = 970714 returns 0714

mid( Date,3,2 ) where Date = 970714 returns 07

For a more complicated example, see the index function.

Not applicable

Re: substring in qlikview?

You're right. The two solutions are good.

thanks you

Community Browser