# 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
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.

Tags (2)
1 Solution

Accepted Solutions
Highlighted
Valued Contributor III

## Re: trim statement

please have a look

17 Replies
Highlighted
Honored Contributor II

## Re: trim statement

What are you wanting to get?

Highlighted
Contributor III

## Re: trim statement

Last number ,basically

Highlighted
Valued Contributor III

## Re: trim statement

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

Highlighted
Contributor III

## Re: trim statement

No it doesnot give me any value beside ( -)

Highlighted
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
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
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
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
Valued Contributor

right(PANACNO,1)