Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
micheledenardi
Specialist II
Specialist II

Match() Function

Hi guys,

I'm usign Match() function into a complex script expression to create one new field.

I'm using the following code:

2018-04-20 14_05_44-Modifica Script [C__Users_denardm1_Desktop_test Locale.qvw].png

And the result is:

2018-04-20 14_03_52-QlikView x64 - Copia del rivenditore - [C__Users_denardm1_Desktop_test Locale.qv.png

For the "h" record DOCTYPE=null() so I thought that match() function returns -1 because Null is different from ZRE and ZOFR... but is not....


How can write the script to have the same result ?

I would like to avoid using an approach with "or isnull(DOCTYPE)" like:


if(not match(DOCTYPE,'ZRE','ZOFR') or isnull(DOCTYPE),-1,0) as Result

Because, as i wrote, the expression is very complex and i would like to resolve this issue without using "OR" statement.

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
1 Solution

Accepted Solutions
sunny_talwar

Had similar issues with match and null values

Null Value with Match/WildMatch and Like

Not sure if this is any better, but look at result 2

Load

*,

not match(DOCTYPE,'ZRE','ZOFR') as Result,

not (DOCTYPE Like 'ZRE' or DOCTYPE Like 'ZOFR') as Result2;

load * inline [

DOCTYPE,text

ZRE,a

ZOFR,b

YOFR,c

YOF,d

ZOE,e

ZOF,f

ZMTE,g

,h

];

View solution in original post

2 Replies
sunny_talwar

Had similar issues with match and null values

Null Value with Match/WildMatch and Like

Not sure if this is any better, but look at result 2

Load

*,

not match(DOCTYPE,'ZRE','ZOFR') as Result,

not (DOCTYPE Like 'ZRE' or DOCTYPE Like 'ZOFR') as Result2;

load * inline [

DOCTYPE,text

ZRE,a

ZOFR,b

YOFR,c

YOF,d

ZOE,e

ZOF,f

ZMTE,g

,h

];

micheledenardi
Specialist II
Specialist II
Author

Super Sunny !!!

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.