Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
bobbydave
Creator III
Creator III

ApplyMap result using an if statement

So I am using an ApplyMap and the results are correct. ... sort of.

My resultant table should only show X,Y,Z and not have A and B also.

My group has more names than listed below but only those 3 names below are using the ApplyMap functionality. The other names should then be ignored in my resultant table.

In my resultant table, for my dimension, I am using

if(Service = 'A*', NULL(), Service)

This is the important part, I need the wildcard A*, rather than say

if(Service = 'A, AB, ABC, ABCD', NULL(), Service)

Resultant table:

ServiceNumber
X1
Y2
Z3
A4
AB5
ABC7
ABCD8

Mapping table

GroupService
JohnX
MaryY
RobZ
1 Solution

Accepted Solutions
avinashelite

Try like this

Temp:

Mapping LOAD

Service,

Group

from table

where Service='X' or Service='Y' or Service='Z' ;


Resultant_Table:

LOAD

Service,

Number,

applymap('Temp',Service,null()) as Group

from table;

//since the mapping table has only the values for X ,Y and Z rest for the values will return as null()


Hope this helps you

View solution in original post

9 Replies
Colin-Albert

Your question does not show the applymap statement you are using. Can you post your applymap statement?

sunny_talwar

What is the source data look like. I think I am not able to understand the complete issue here.

avinashelite

Try like this

Temp:

Mapping LOAD

Service,

Group

from table

where Service='X' or Service='Y' or Service='Z' ;


Resultant_Table:

LOAD

Service,

Number,

applymap('Temp',Service,null()) as Group

from table;

//since the mapping table has only the values for X ,Y and Z rest for the values will return as null()


Hope this helps you

bobbydave
Creator III
Creator III
Author

ApplyMap('MapServiceToGroup', Group) as Service

I am getting the correct results but at the same time, I only want the X Y and Z to show.

Attached is a dummy app, The first table shows my result, the second shows my Wildcard if statement

sunny_talwar

Have you attached the correct qvw? I am only seeing one table

Capture.PNG

avinashelite

did you try my suggestion (please check my last post )

bobbydave
Creator III
Creator III
Author

Attached again

avinashelite

Try like this

Try like this

Temp:

Mapping LOAD

Service,

Group

from table

where Service='X' or Service='Y' or Service='Z' ;


Resultant_Table:

LOAD

Service,

Number,

applymap('Temp',Service,null()) as Group

from table;

//since the mapping table has only the values for X ,Y and Z rest for the values will return as null()

bobbydave
Creator III
Creator III
Author

This is exactly what I needed. I didn't have the NULL() at the end of my ApplyMap() function.

Thanks