Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Incremental load error - loading QVD failing

I am doing an incremental load through the following script:

//Load Incremental Data only from the main excel table after having created a QVD on initial load
LET vLoadTime = Num(Now());
[Main Data]:
LOAD [Script Number],
     
[Drug Name],
    
Date(Floor([Date Dispensed])) as DateDispensed,
    
// Directions,

     [Repeat or Original],
//   [Doctor Name],

//     [Doctor Number],
     QTY,
     
[MedAid Amount],
     
Shortfall,
     
[Med Aid] as [Payment Type],
     
[Supply days],
     
//[Drug Code]

     Num([Drug Code],'000000') as [Drug Code]
     
Num([Doctor Number],'00000') as [Doctor Number],
     
[Retail Pharmacy],
     
Branch,
   
num(Date_Modified) as Date_Modified
FROM
[$(vFolderSourceData)Datawarehouse_2.xlsx]
(
ooxml, embedded labels, table is Datawarehouse)
Where Date_Modified >= $(vLoadTime) and Date_Modified <= $(vLoadTime);

//Initial store [Main Data] into QVD commented out after initial load

//STORE [Main Data] into '$(vFolderSourceData)QVDs\
//PrescriptionHistory.qvd' (qvd);

//Concatenate with QVD

Concatenate ([Main Data])
LOAD [Script Number],
     
[Drug Name],
    
Date(Floor([Date Dispensed])) as DateDispensed,
    
// Directions,

     [Repeat or Original],
//   [Doctor Name],

//     [Doctor Number],
     QTY,
     
[MedAid Amount],
     
Shortfall,
     
[Med Aid] as [Payment Type],
     
[Supply days],
     
//[Drug Code]

     Num([Drug Code],'000000') as [Drug Code]
     
Num([Doctor Number],'00000') as [Doctor Number],
     
[Retail Pharmacy],
     
Branch,
      num(
Date_Modified) as Date_Modified
FROM '$(vFolderSourceData)QVDs\
PrescriptionHistory.qvd' (
qvd)
Where not Exists([Script Number]);

//Replace Old QVD file

IF ScriptErrorCount = 0 then
STORE [Main Data] into '$(vFolderSourceData)QVDs\
PrescriptionHistory.qvd' (
qvd);
//LET vLastLoadTime = vLoadTime;

END If

The initial incremental load for fresh data goes fine according to the following screen shot (as the data has not been updated with any fresh data so we expect zero records loaded):


Screen Shot 2014-12-20 at 09.43.52.png


However, i get an error when try to fetch the QVD file.  The error is as per the following screen shot:


Screen Shot 2014-12-20 at 09.45.51.png

The same folder which the system says it cannot find is the same folder from which the Excel file is being loaded from.What could be the problem?


Your assistance will be greatly appreciated.


Regards.


Chris

9 Replies
vivek_niti
Partner - Creator
Partner - Creator

Hi,

your variable vFolderSourceData is not returning any value.

try this:

$(vFolderSourceData)QVDs\PrescriptionHistory.qvd (qvd)

Anonymous
Not applicable
Author

HI Vivek

Many thanks for your prompt response, most appreciated.  i tried your recommendation and the following same errors comes out:

Screen Shot 2014-12-20 at 11.44.15.png

Many thanks

Chris

terezagr
Partner - Creator III
Partner - Creator III

I think your assumption that the first part of the load is fine is wrong. You are basically saying load everything that is >=now and in the same time everything <=now. Therefore, you are loading 0 data.

Also, I think your relative path is set incorrectly. How does your $(vFolderSourceData) looks like? It seems like you are not reaching the right directory...

Try to use instead of the variable absolute path for the qvd.

MK_QSL
MVP
MVP

?????????

Is below one OK?

Where Date_Modified >= $(vLoadTime) and Date_Modified <=$(vLoadTime);

Anonymous
Not applicable
Author

Many thanks for your input.  I removed the <=  and left the >= in the where clause.

I used the absolute path for loading the QVD by locating the file and the following error pops up:

Screen Shot 2014-12-20 at 12.55.03.png

Regards

Chris

terezagr
Partner - Creator III
Partner - Creator III

LET vLoadTime = Num(Now());
[Main Data]:
LOAD [Script Number],
     
[Drug Name],
    
Date(Floor([Date Dispensed])) as DateDispensed,
    
// Directions,

     [Repeat or Original],
//   [Doctor Name],

//     [Doctor Number],

     QTY,
     
[MedAid Amount],
     
Shortfall,
     
[Med Aid] as [Payment Type],
     
[Supply days],
     
//[Drug Code]

     Num([Drug Code],'000000') as [Drug Code]
     
Num([Doctor Number],'00000') as [Doctor Number],
     
[Retail Pharmacy],
     
Branch,
   
num(Date_Modified) as Date_Modified
FROM
[..\Datawarehouse_2.xlsx](ooxml, embedded labels, table is Datawarehouse);


Concatenate ([Main Data])
LOAD [Script Number],
     
[Drug Name],
    
Date(Floor([Date Dispensed])) as DateDispensed,
    
// Directions,

     [Repeat or Original],
//   [Doctor Name],

//     [Doctor Number],

     QTY,
     
[MedAid Amount],
     
Shortfall,
     
[Med Aid] as [Payment Type],
     
[Supply days],
     
//[Drug Code]

     Num([Drug Code],'000000') as [Drug Code]
     
Num([Doctor Number],'00000') as [Doctor Number],
     
[Retail Pharmacy],
     
Branch,
      num(
Date_Modified) as Date_Modified
FROM ..\QVDs\PrescriptionHistory.qvd (qvd)
Where not Exists([Script Number]);

STORE [Main Data] into ..\QVDs\PrescriptionHistory.qvd (qvd);

Anonymous
Not applicable
Author

Hi

Many thanks, the following script error is raised when using the suggested script:

Screen Shot 2014-12-20 at 13.28.10.png

Regards

Chris

terezagr
Partner - Creator III
Partner - Creator III

Ok, try to look for the file…Does the file really exists in the location specified? Where is your file exactly saved?

Anonymous
Not applicable
Author

Many thanks for all your efforts.  Yes the file exists and is in a QVD folder where the  Datawarehouse_2 excel file is.  I think this could be an issue with running this on a Parallels Desktop virtual machine on a MacBook.  Would it be.  I have actually located the qvd file in the QVD folder.

Regards.