Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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!
left(FieldName, 2)
Is this to be shown in a listbox? I guess not. Where do you want this to happen?
Use following :
PurgeChar(Left([Field:],2), '1234567890')
May be this:
LOAD Field,
If(IsText(Left(Field, 2)), Left(Field, 2)) as NewField
FROM ....
New field will only have two letters where they are text and not number. But it will include a value like 1A or B3
Sunny, How about if values are like below
Field:
ABAS
SDFW
1244S
SDFG
SD646
545SD
SDE12
124563
12448L
SDFGL
145877
A123
May be this?
If(Index(Field,'AB'),'AB', If(Index(Field,'SD'),'SD')) as NewField
Like I said, my way would include A1.... but the issue with your code is that it won't include CD7264 for example
Well he wanted first 2 letters and not numbers: The first 2 letters may be anything . AB OR SD are just examples I think. His requirement is bit unclear - I guess he dont want anything if there is any numeric value .
I have taken care of it in my expression.
Thank you 🙂 It Worked.
But your solution isn't correct either. You would end up with 6 times an SD value, while Murali only lists 5 of them.
I think the expression will be a bit more complex. Something along the lines of
IF (Len(Left(PurgeChar(Field, '1234567890'), 2) = 2,
Left(PurgeChar(Field, '1234567890'), 2))
And then we all hope for a QlikView expression optimiser, don't we?
OK.
Please post correct requirements next time.