Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
Can you do something in Qlik via a function/expression to determine if a character in a field is either a text or a number.
I have some postcode data like
I want to be able to say if the first character is a letter and the second is a number then do something. If the first character is a letter and the second character is also a letter then do something else..
Is there a function to do this by any chance?
Thanks
J
Hi Jamel!
Try this inside Qlikview:
IF(
ISTEXT(LEFT(CODE, 1)) AND ISNUM(RIGHT(LEFT(CODE, 2),1)),
'action 1',
if(ISTEXT(LEFT(CODE, 1)) AND ISTEXT(RIGHT(LEFT(CODE, 2),1)), 'action2'))
Rgds,
Benazir
we use applymap to do that and precalculate in the script.
It takes seconds to implement with excel
M:
MAPPING LOAD * INLINE [
From, To
LA, 0
L2, 1
];
...
if(applymap('M',fieldname) = 1, 'Do sth', 'Do sth else')
...
Thanks Dion.
I am actually loading this data into Qlik from Excel, so is there a function to do this in Excel? If so, i can sort this from the source!!
Thanks
J
Hi Jamel
If( istext( Left( Postcode, 1)) and isnum( Left( Postcode, 2)), 'Then', 'Else' ) as X
istext and isnum returns true/false
/Teis
yes, create a lookup table and use vlookup
Is correct, but this means behaviour is the same across all values. In reality this does not always happen.
Thus the suggestion for a mapping table.
Hi Jamel!
Try this inside Qlikview:
IF(
ISTEXT(LEFT(CODE, 1)) AND ISNUM(RIGHT(LEFT(CODE, 2),1)),
'action 1',
if(ISTEXT(LEFT(CODE, 1)) AND ISTEXT(RIGHT(LEFT(CODE, 2),1)), 'action2'))
Rgds,
Benazir
This worked a treat. Thanks Benazir and thanks everyone else for your assistance
Happy to help Jamel
What a steal congrats