Discussion Board for collaboration related to QlikView App Development.
Hi,
I want to add a flag and set this to 1 if the name is equal to Trev or Ross, I have tried the following script but QlikVIew does not like it?
If(Name in ('Trev','Ross'),1,0) as Flag
Thanks
Ivan
Hi, use match instead
If(match(Name,'Trev','Ross'),1,0) as Flag
Rgds
Nice Work Hector
how to write multiple names in "Name"?
@Shax how many names are we talking about? If it is way too high, we can get the desired output using Mapping Load and Applymap concept. Something like below:
Mappingtable:
Mapping load
Name
Value
From Table_Name:
MainTable:
Load Name,
Applymap('Mappingtable',Name,'Unknown') as Flag
From Table_Name;
You may try:
If(wildmatch(Name1 & '|' & Name2,'*Trev*','*Ross*'),1,0) as Flag
But you will need to specify all relevant name-fields directly and also using wildmatch() by applying wildcards to your search-strings which may result in some overlapping.
Alternatives could be to nest multiple match() logic or to transform your crosstable-structures with a crosstable-statement into a stream-data-structure - means it remains only one name-field and the multiple values are distributed to records.
- Marcus
What about multiple conditions in the same measure/column?
Like this;
If(match(nativeCode, 1, 2, 3, ),'Minor severity')
If(match(nativeCode, 4, 5, 6, ),'Medium severity')
If(match(nativeCode, 7, 8, 9, ),'Critical')