Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
could you make the question little bit clear, because incremental load is done based on the date field Incremental Load
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
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
Hi Manish,
I hope this would Working out. Let me try this one and let you know Manish.
Thanks for your help..
Hi Manish,
Thank you very much its working out.
Regards,
Vignesh