Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Sept. 16, Qlik Product Portfolio Strategy and Roadmap for Data Integration 11 AM ET REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner
Partner

get first 3 characters of field

Hi all,

i have a field that i am currently stripping all numbers from.

PurgeChar([Cell Name],'0123456789') as [BaseStation Name],

but i have found that for some particular values of this field i need to keep the first number.

here is an example of the values..

[Cell Name]

ADDAX1

ADDAX2

ADDAX3

PLU1

PLU2

PLU3

BO31

BO32

BO33

BO41

BO42

BO43

BO51

BO52

what i want is an if statement before my Purgechar statement to say that if the Cell name =BO* then take the first 3 characters (i.e. BO3, BO4 etc) otherwise do my purgechar statement.

I cant seem to get it to work, can anyone help?

1 Solution

Accepted Solutions
stevedark
MVP
MVP

You will need this:

if(left([Cell Name], 2) = 'BO', left([Cell Name], 3), purgechar([Cell Name], '0123456789')) as [BaseStation Name],

Hope that helps,

Steve

View solution in original post

5 Replies
Not applicable

hi

left([Cell Name],3)

stevedark
MVP
MVP

You will need this:

if(left([Cell Name], 2) = 'BO', left([Cell Name], 3), purgechar([Cell Name], '0123456789')) as [BaseStation Name],

Hope that helps,

Steve

View solution in original post

Not applicable

hi

if(wildmatch([Cell Name],'BO*'),left([Cell Name],3),[Cell Name]) as new_[Cell Name]

MK_QSL
MVP
MVP

IF(LEN(PurgeChar([Cell Name],'0123456789'))>3, 

     PurgeChar([Cell Name],'0123456789'),

     Left([Cell Name],3)) as [BaseStation Name],

colin_albert

if(left(YourField,2) = 'BO', left(YourField,3), YourPurgeCharExpression) as NewField