Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Incremental Load

Hi Friends,

Am try to QVD Generator Where it has two condition, If the file or Table is Exists in the generator the it should append the data or it should load full data from the database. Kindly help me with any Example where it should check automatically in load script.

Thanks in Advance

Regards,

Vignesh

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Set vFileName                    = 'QVD\File_Name.qvd';                         //Give you full path or relative path..
Let vFile                    = SubField('$(vFileName_PM_ACTION)','\',-1);
Let vFileExists        = IF(FileSize('$( vFileName)')>0,-1,0);

If $(vFileExists) Then

Incremental_Load:
LOAD * FROM $(vFileName) (qvd);

Max_Last_Changed:
Load Max(LAST_CHANGED) as Max_LAST_CHANGED Resident Incremental_Load;

Let vMax_Last_Changed = TimeStamp(PEEK('Max_LAST_CHANGED',0,'Max_Last_Changed'));

Drop Table Max_Last_Changed;
Drop Table Incremental_Load;

Final_Load:
LOAD *;
SQL SELECT * FROM APP."Table_Name"
WHERE LAST_CHANGED > to_date('$(vMax_Last_Changed)', 'DD/MM/YYYY HH24:MI:SS');

//The above LAST_CHANGED is fieldname as a DateTimeStamp and this is based on Oracle Database.. Change accordingly for //SQL Database

           
Concatenate(Final_Load)
LOAD * FROM        QVD\File_Name.qvd(qvd)
Where Not Exists (Primary_Key);


Store Final_Load into QVD\ File_Name.qvd;

Drop Table Final_Load;                                                                                                                              

Else

Initial_Load:
LOAD *;
SQL SELECT * FROM APP."Table_Name";

           
Store Initial_Load into QVD\File_Name.qvd;                                                                                                
Drop Table Initial_Load;                                                                                                                                                                             
ENDIF

View solution in original post

5 Replies
Not applicable
Author

could you make the question little bit clear, because incremental load is done based on the date field Incremental Load

MK_QSL
MVP
MVP

Set vFileName                    = 'QVD\File_Name.qvd';                         //Give you full path or relative path..
Let vFile                    = SubField('$(vFileName_PM_ACTION)','\',-1);
Let vFileExists        = IF(FileSize('$( vFileName)')>0,-1,0);

If $(vFileExists) Then

Incremental_Load:
LOAD * FROM $(vFileName) (qvd);

Max_Last_Changed:
Load Max(LAST_CHANGED) as Max_LAST_CHANGED Resident Incremental_Load;

Let vMax_Last_Changed = TimeStamp(PEEK('Max_LAST_CHANGED',0,'Max_Last_Changed'));

Drop Table Max_Last_Changed;
Drop Table Incremental_Load;

Final_Load:
LOAD *;
SQL SELECT * FROM APP."Table_Name"
WHERE LAST_CHANGED > to_date('$(vMax_Last_Changed)', 'DD/MM/YYYY HH24:MI:SS');

//The above LAST_CHANGED is fieldname as a DateTimeStamp and this is based on Oracle Database.. Change accordingly for //SQL Database

           
Concatenate(Final_Load)
LOAD * FROM        QVD\File_Name.qvd(qvd)
Where Not Exists (Primary_Key);


Store Final_Load into QVD\ File_Name.qvd;

Drop Table Final_Load;                                                                                                                              

Else

Initial_Load:
LOAD *;
SQL SELECT * FROM APP."Table_Name";

           
Store Initial_Load into QVD\File_Name.qvd;                                                                                                
Drop Table Initial_Load;                                                                                                                                                                             
ENDIF

Not applicable
Author

I have a QVD generator File in a particular location. i do have scripted incremental load based on the Primary key of the table. And its working fine. What exactly i need is, i have to write a script in Which it should check the QVD generator file whether its existing or not. If the File is Existing it should automatically run the incremental load script if not it should run the full load script

Not applicable
Author

Hi Manish,

I hope this would Working out. Let me try this one and let you know Manish.

Thanks for your help..

Not applicable
Author

Hi Manish,

Thank you very much its working out.

Regards,

Vignesh