Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
chibi
Creator
Creator

Incremental load script does not work in QlikSense

Hi I'm trying to load incremental data but it keeps fetching all the data instead of showing 0. Where am I going wrong?

 

maxAgency:
LOAD
max(sold_agency_no) AS m_sold_agency_no
from [lib://EDP_QVD/dim_agency.qvd](qvd);

Let m_sold_agency_no = num(peek(m_sold_agency_no,0,maxAgency);

drop table maxAgency;


[dim_agency]:

LOAD
agency_no AS sold_agency_no,* ;
SELECT *
FROM "magXXX_edp_prod"."sales_dw"."dim_agency"."agency_no$"
where agency_no > '$(m_sold_agency_no)';

Concatenate
LOAD * FROM [lib://EDP_QVD/dim_agency.qvd](qvd);

store dim_agency into [lib://EDP_QVD/dim_agency.qvd](qvd);

16 Replies
stevejoyce
Specialist II
Specialist II

So this is in your "agency" tab in load script - the word doc?  You have exit script at the end of it.  so you are not even getting to your "Incremental Load" tab.

 

Or move drag and move this tab to the end of your script and "exit script" before it.

 

you can use multi-line commenting with /*    */

chibi
Creator
Creator
Author

Initially I wanted it to be in one script i did not want to create additional tabs. I wanted to create the QVD and the create an incremental load in the same script. Now the QVD is created but the incremental load is not working. How can script this better in a single load script? should remove the comments from the original and delete the incremental load script tab? 

 

stevejoyce
Specialist II
Specialist II

it can be in the same script.  remove exit script from your first tab.  your script is ending before it gets to your last sheet.

 

you can always have an if-condition if you have different scenarios to run pieces of code.

 

let vRunIncremental = 1;

 

if $(vRunIncremental) = 1 Then

   <incremental script>

else

  <other script>

end if

chibi
Creator
Creator
Author

Okay so I've put it all into the initial script and remove the incremental load script and the MaxAgency table is loading 1 line. But when it gets to the actual table in the DB it loads the entire record and the concatenate duplicates it. Is there something wrong with the data?  I chose agency_no because its the primary key 

stevejoyce
Specialist II
Specialist II

looks like your m_sold_agency_no  is coming back null.

 

just try to get this to work first, and see that m_sold_agenyc_no has a value.

 

maxAgency:

LOAD

Max(sold_agency_no) AS m_sold_agency_no

from [lib://EDP_QVD/dim_agency.qvd](qvd);

 

Let m_sold_agency_no = num(peek('m_sold_agency_no',0,'maxAgency'));

TRACE m_sold_agency_no: $(m_sold_agency_no)

chibi
Creator
Creator
Author

looks like it's not fetching anything. 

chibi_0-1632969990480.png

could it be because of the data? one column in sold_agency_no is set to 0. I'm going to change that now and try again 

stevejoyce
Specialist II
Specialist II

Can you take a screen shot of the 1 row of data and what that looks like. 

And what do your sold_agency_no values look like.  Are these numeric values? Can you show a sample of these values from [lib://EDP_QVD/dim_agency.qvd](qvd); (not the max value, a sample of the underlying values).

 

 

maxAgency:

LOAD

Max(sold_agency_no) AS m_sold_agency_no

from [lib://EDP_QVD/dim_agency.qvd](qvd);

 

Let m_sold_agency_no = peek('m_sold_agency_no',0,'maxAgency');

TRACE m_sold_agency_no: $(m_sold_agency_no)