
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Tags:
- new_to_qlikview
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi
left([Cell Name],3)


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi
if(wildmatch([Cell Name],'BO*'),left([Cell Name],3),[Cell Name]) as new_[Cell Name]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
IF(LEN(PurgeChar([Cell Name],'0123456789'))>3,
PurgeChar([Cell Name],'0123456789'),
Left([Cell Name],3)) as [BaseStation Name],


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if(left(YourField,2) = 'BO', left(YourField,3), YourPurgeCharExpression) as NewField
