Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
everest226
Contributor III

trim statement

HI i have a field Name PANACNO which his following values .

PANACNO

1:1-2-3-4-5

1:1-2-3-4-5-6

1:1-2-3/2:4-5-6

1:1-2-4-3

1:1-2/2:3-4

1:2-1

1:2-1-3

1:2-3

1:2-3-4

and my statement is following

if(len(PANACNO )>3,
mid(PANACNO ,
Index(PANACNO ,'-',-1) ),1)



which will give me value but with(-).  i only want number.

stalwar1

Tags (2)
1 Solution

Accepted Solutions
Highlighted
robin_hausdoerfer
Valued Contributor III

Re: trim statement

please have a look

View solution in original post

17 Replies
Highlighted
mwoolf
Honored Contributor II

Re: trim statement

What are you wanting to get?

Highlighted
everest226
Contributor III

Re: trim statement

Last number ,basically

Highlighted
robin_hausdoerfer
Valued Contributor III

Re: trim statement

try subfield(PANACNO,'-',-1)

Highlighted
everest226
Contributor III

Re: trim statement

No it doesnot give me any value beside ( -)

Highlighted
robin_hausdoerfer
Valued Contributor III

Re: trim statement

what result do you expect for?:

PANACNO

1:1-2-3-4-5

1:1-2-3-4-5-6

1:1-2-3/2:4-5-6

1:1-2-4-3

1:1-2/2:3-4

1:2-1

1:2-1-3

1:2-3

1:2-3-4

Highlighted
mwoolf
Honored Contributor II

Re: trim statement

If you want to fix your expression:

if(len(PANACNO )>3,
mid(PANACNO ,
Index(PANACNO ,'-',-1) )+1,1)

Highlighted
everest226
Contributor III

Re: trim statement

                                        Trying to capture

1:1-2-3-4-5                            5  

1:1-2-3-4-5-6                         6

1:1-2-3/2:4-5-6                        6

1:1-2-4-3                                 3

1:1-2/2:3-4                              4

Highlighted
robin_hausdoerfer
Valued Contributor III

Re: trim statement

... works for me:

LOAD SubField(PANACNO,'-',-1) as FIELD INLINE [

    PANACNO

    1:1-2-3-4-5

    1:1-2-3-4-5-6

    1:1-2-3/2:4-5-6

    1:1-2-4-3

    1:1-2/2:3-4

    1:2-1

    1:2-1-3

    1:2-3

    1:2-3-4

];

Highlighted
zebhashmi
Valued Contributor

Re: trim statement

right(PANACNO,1)