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: 
MarioGabriel
Contributor II
Contributor II

Issue Migrating IntervalMatch from QlikView to Qlik Sense – Only Field Names, No Data Returned

Hello,

I'm currently in the process of migrating an existing QlikView application to Qlik Sense. One part of the script involves using IntervalMatch() to map account numbers to predefined level 3 ranges for account grouping.

However, after the migration, I’m facing an issue where Qlik Sense only returns the field names, but no actual data is shown in the resulting table (even though the script executes without error).

What I’ve done:

  • Recreated the exact logic from QlikView using the same QVD files.

  • Verified the data is present by previewing the individual source tables (accounts, intervals).

  • Tried both INNER JOIN and LEFT JOIN around IntervalMatch() but the result is the same – no rows.

What seems strange:

  • The exact same script with IntervalMatch works in QlikView, but fails silently in Qlik Sense.

  • It appears to load structure (columns) but no content.

Has anyone experienced similar behavior with IntervalMatch() after migrating to Qlik Sense? Are there best practices or known differences I should be aware of?

I’ll attach a simplified part of the script to clarify.

 

Sub Formulate_Account_Grouping
 
/*
Actually we want to group accounts by 4 levels or categories
starting from level 3
*/
/*
these are the accounts that we want per company
*/
account_level:
LOAD distinct 
GMAID as account_row_id,
GMCO as company_id,
GMOBJ as account_num
FROM
[lib://QVD/Tables/PRODDTA.F0901.qvd]
(qvd)
where  GMCO <> 99999
and wildmatch(GMLDA ,6,7,8)
and (GMPEC <> 'N' or GMOBJ=4999);
//and GMPEC <> 'N';
/*************************************************************************************************/
 
 
/*
let's formulate the starting level which is level 3
*/
temp_acc_level_3:
LOAD distinct 
GMCO as company_id,
GMOBJ as acc_num_3,
GMDL01 as acc_level_3
from [lib://QVD /Tables/PRODDTA.F0901.qvd]
(qvd)
where  
GMCO <> 99999
and  GMLDA = 3
and GMPEC = 'N';
 
temp_acc_level_3_2:
NoConcatenate
LOAD * Resident temp_acc_level_3
Order by company_id asc,acc_num_3 desc;
drop Table temp_acc_level_3;
 
temp_acc_level_3_3:
LOAD 
        company_id,
acc_level_3,
acc_num_3, 
acc_num_3 as start_account,
if(RowNo() = 1 or company_id <> Previous(company_id),99999,Peek(start_account) -1 ) as end_account
Resident temp_acc_level_3_2;
drop Table temp_acc_level_3_2;
 
 
temp_match:
IntervalMatch(account_num) 
    LOAD start_account,end_account
Resident temp_acc_level_3_3;
 
INNER JOIN(account_level)
LOAD * Resident temp_match;
drop Table temp_match;
 
INNER JOIN(account_level)
LOAD start_account,end_account, acc_level_3,company_id,acc_num_3
Resident temp_acc_level_3_3;
drop Table temp_acc_level_3_3;
drop fields start_account,end_account;
 

Would greatly appreciate your input. Thanks!

 

 

Labels (4)
1 Solution

Accepted Solutions
MarioGabriel
Contributor II
Contributor II
Author

Thank you, Rafael. I had already used the Num function, but it didn’t work until I tried Num#. Now I have changed my script to the following:

 

// Load Level 4+ accounts that need to be mapped to Level 3
account_level:
LOAD DISTINCT
GMAID as account_row_id,
Num#(GMCO) as company_id,
Num#(GMOBJ) as account_num
FROM [lib://QVD/Tables/PRODDTA.F0901.qvd] (qvd)
WHERE GMCO <> 99999
AND WildMatch(GMLDA, '6', '7', '8')
AND (GMPEC <> 'N' OR GMOBJ = 4999);

// Load Level 3 accounts with their descriptions
temp_acc_level_3:
LOAD DISTINCT
Num#(GMCO) as company_id,
Num#(GMOBJ) as acc_num_3,
Num#(GMDL01) as acc_level_3
FROM [lib://QVD/Tables/PRODDTA.F0901.qvd] (qvd)
WHERE GMCO <> 99999
AND GMLDA = 3
AND GMPEC = 'N';

// Sort by company and account number 
temp_acc_level_3_2:
NoConcatenate
LOAD *
RESIDENT temp_acc_level_3
ORDER BY company_id ASC, acc_num_3 desc;
DROP TABLE temp_acc_level_3;

// Create ranges for each Level 3 account
temp_acc_level_3_3:
LOAD
company_id,
acc_level_3,
acc_num_3,
acc_num_3 AS start_account,
if(RowNo() = 1 or company_id <> Previous(company_id),99999,Peek(start_account) -1 ) as end_account
RESIDENT temp_acc_level_3_2
ORDER BY company_id ASC, acc_num_3 desc;
DROP TABLE temp_acc_level_3_2;

// Create IntervalMatch for Level 3
temp_match:
IntervalMatch(account_num, company_id)
LOAD
start_account,
end_account,
company_id
RESIDENT temp_acc_level_3_3;

// Join the interval match results to account_level
LEFT JOIN(account_level)
LOAD *
RESIDENT temp_match;
DROP TABLE temp_match;

// Join the Level 3 details
LEFT JOIN(account_level)
LOAD
start_account,
end_account,
acc_level_3,
company_id,
acc_num_3
RESIDENT temp_acc_level_3_3;
DROP TABLE temp_acc_level_3_3;

// Clean up temporary fields
DROP FIELDS start_account, end_account;

The script is now working as it should. I really appreciate everyone’s help. Thank you!

MarioGabriel_0-1749021415212.png

 

View solution in original post

12 Replies
-SW-
Partner - Creator II
Partner - Creator II

I have encountered similar problems before and in my case it was how Qlik Sense was referring my fields as text as opposed to numbers. Can you try and force all relevant fields with Num() and try again?

MarioGabriel
Contributor II
Contributor II
Author

Thank you for your reply, but I have already tried it and still didn’t work.

Mark_Little
Luminary
Luminary

I have not seen an issue with the interval match it should work the same (And has for me).

I have seen different behaviour on the Peek or Previous (Previous I believe, sorry can't remember).

I would check this table is getting created as expected

temp_acc_level_3_3:
LOAD 
        company_id,
acc_level_3,
acc_num_3, 
acc_num_3 as start_account,
if(RowNo() = 1 or company_id <> Previous(company_id),99999,Peek(start_account) -1 ) as end_account
Resident temp_acc_level_3_2;
drop Table temp_acc_level_3_2;
 
Mark

 

rafaelencinas
Partner - Creator II
Partner - Creator II

Reading your code:

1 - Order by your code here:

temp_acc_level_3_3:
LOAD
company_id,
acc_level_3,
acc_num_3,
acc_num_3 as start_account,
if(RowNo() = 1 or company_id <> Previous(company_id),99999,Peek(start_account) -1 ) as end_account
Resident temp_acc_level_3_2

Order by company_id , acc_num_3 

;

 

2 - Reload all tables, checking DataTypes of each field to avoid mistakes with math operations in Where Clause

 

Bye!

 


 

 

 

 

Senior Qlik Architect
Cobra, Stallone, "You're a problem and I'm the solution"
MarioGabriel
Contributor II
Contributor II
Author

Hi Mark,

Thank you for your reply. The issue lies with this table: as you can see, the table is returning zeros. I have tried nearly everything, but I still am not getting any data.

MarioGabriel_0-1748860912679.png

 

-SW-
Partner - Creator II
Partner - Creator II

can you show some example values of

account_num in one table and

start_account,end_account
in another table?
 
MarioGabriel
Contributor II
Contributor II
Author

Hello. Here are the two tables: the start_account column is interpreted as text (tagged $ascii $text), while end_account is numeric but displays many “–” entries (nulls).MarioGabriel_0-1748872997932.png

MarioGabriel_1-1748873016506.pngMarioGabriel_2-1748873043336.png

 

MarioGabriel
Contributor II
Contributor II
Author

Thank you Rafael for the suggestion. I did add the ORDER BY company_id, acc_num_3 clause to the resident load exactly as you showed, but the end_account values are still not lining up the way I expect. I also reloaded everything and verified that company_id and acc_num_3 are numeric, so the sort should work but it isn’t.

-SW-
Partner - Creator II
Partner - Creator II

can you try adding CompanyID to the intervalmatch?

temp_match:
IntervalMatch(account_num,company_id) 
    LOAD start_account,end_account,company_id
Resident temp_acc_level_3_3;