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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

intervalmatch vs. applymap

I find using applymap over intervalmatch function better.As we know intervalmatch creates couple of tables (includes a synthetic table-which we should try to avoid).

As I am not very experienced QV professional,just wondering if you can always replace intervalmatch with applymap.(unless we want to display start,end of categories on sheet objects).

//if you have fewer buckets,use inline wizard otherwise dump your data onto an excel file.
//Tenure
TenureCategoryfn:
mapping LOAD * INLINE [
Tenure, TenureCategory
0, New
1, 1 to 3
2, 1 to 3
3, 3 to 5
4, 3 to 5
];

EmployeeData:
Load
// ..other fields,
applymap('TenureCategoryfn',age(termdate,joindate),'>5') as TenureCategory
from [.\datasource\HR Data.txt]


////Tenure - commented out
//TenureCategoryfn:
//LOAD * INLINE [
// Start, End, AgeCategory
// 0, 0, New
// 1, 2, 1 to 3
// 3, 4, 3 to 5
// 5, 500, >5
//];
//intervalmatch(Tenure) load Start,End resident TenureCategoryfn;


Thanks.

1 Reply
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP


Raj wrote:
includes a synthetic table-which we should try to avoid).


You can eliminate the extra table and synthetic key by usng JOIN in the IntervalMatch. For example:

JOIN (mytab) IntervalMatch (Date) LOAD RangeStart, RangeEnd




Raj wrote:
...,just wondering if you can always replace intervalmatch with applymap.(unless we want to display start,end of categories on sheet objects).



No, they are not interchangeable. applyMap creates a 1:1 relationship. intervalMatch creates a 1:n relationship.

Your example above correctly uses mapping. IntervalMatch would be unnecessary unless Tenure could map into multiple Categories.

-Rob