Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
MuraliPrasath
Creator III
Creator III

Trim Function Question.

Hi,

I want show only the first two letters in my field. how to achieve this?

Ex:

Field:

ABAS

SDFW

1244S

SDFG

SD646

545SD

SDE12

124563

12448L

SDFGL

145877

I need only the first two letter's not numbers.

Expecting Result:

Field:

AB

SD

SD

SD

SD

SD

Need help!

12 Replies
jayanttibhe
Creator III
Creator III

I think if that's the case then we would have done  : Result from your  Expression  would have achieved easily by

Left(PurgeChar([Field:], '1234567890'), 2)

No need to calculate Length of the field and add IF condition 

Peter_Cammaert
Partner - Champion III
Partner - Champion III

True, I messed up as well

My original unposted solution reversed the calls, and that one would be the more correct one. That is, if requirements hadn't changed...

IF (Len(PurgeChar(Left(Field, 2), '1234567890')) = 2,

        Left(Field, 2))


produces

Trim Function Question thread249308.jpg


sunny_talwar

What happens if the Field is A1H293... Is the output needed A1 or AH or A? I guess we lack the clarity as to what was needed here