Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello people,
I need to create an index from a text field.
so I started doing it like this:
if (index (upper ("Text Neg"), 'GIN'), 'Drink'
if (index (upper ("Text Neg"), 'VODKA'), 'Drink'
if (index (upper ("Text Neg"), 'VODCA'), 'Drink', ...
The problem is that there are a lot of words and when it arrives in about 50 ifs it catches.
I'm using QlikSense nov2017.
Do you have any other solution for me not to use all these if's?
I think you misplaced on parenthesis
Pick(
WildMatch("Text Neg",
'*GIN*', '*VODKA*', '*VODCA*'), 'Drink', 'Drink', 'Drink') as Indice,
May be with Pick(WildMatch())
Pick(WildMatch([Text Neg], '*GIN*', '*VODKA*', '*VODCA*', ...), 'Drink', 'Drink', 'Drink', ....) ....
I applied that way.
I think I made a mistake.
Pick(
WildMatch("Text Neg",
'*GIN*', '*VODKA*', '*VODCA*', 'Drink', 'Drink', 'Drink')) as Indice,
I think you misplaced on parenthesis
Pick(
WildMatch("Text Neg",
'*GIN*', '*VODKA*', '*VODCA*'), 'Drink', 'Drink', 'Drink') as Indice,
I see that I missed that in my response also.... fixed my response also
Perfect friend.
It worked. Just one more thing.
for every word I put in "WildMatch" do I have to repaint it in "Pick"?
Example below.
Pick(
WildMatch("Text Neg",
'GIN', 'VODKA', 'VODCA', 'VÓDCA', 'VÓDKA',
'VODIKA', 'VÓDICA', 'VÓDIKA', 'GIM', 'CONHAQUE',
'COMIDA', 'BOLO', 'BOLINHO', 'COMIDA DE PRIMEIRA'
), 'Drink', 'Drink', 'Drink', 'Drink', 'Drink', 'Drink', 'Drink', 'Drink', 'Drink', 'Drink',
'Comida', 'Comida', 'Comida', 'Comida') as Indice,
Yes, or you can do something like this
If(WildMatch("Text Neg",
'GIN', 'VODKA', 'VODCA', 'VÓDCA', 'VÓDKA',
'VODIKA', 'VÓDICA', 'VÓDIKA', 'GIM', 'CONHAQUE'), 'Drink', 'Comida') as Indice
or this
If(WildMatch("Text Neg",
'GIN', 'VODKA', 'VODCA', 'VÓDCA', 'VÓDKA',
'VODIKA', 'VÓDICA', 'VÓDIKA', 'GIM', 'CONHAQUE'), 'Drink',
If(WildMatch("Text Neg",
'COMIDA', 'BOLO', 'BOLINHO', 'COMIDA DE PRIMEIRA'),
'Comida') as Indice
But if you do use Pick, then you will have to repeat Drink for all the matches you make