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

How to get lastmodifieddate

Hi We are Loading QVDs  from Database based on the below code. We are doing an incremetal load here.

if not isnull(QVDCreateTime('$(vQVDPath)IDS_$(tableName).qvd')) then

LoadTime:

Load Max(LastModifiedDate) as LastModifiedDate // Or max(CreatedDate)

From $(vQVDPath)IDS_$(tableName).qvd (qvd);

Let vLastExecTime = timestamp(peek('LastModifiedDate',0,'LoadTime'),'YYYY-MM-DD hh:mm:ss');

//Let LastModifiedTimestamp = '$(vLastExecTime)';

Drop Table LoadTime;

ELSE

  Call FullTableLoad(tableName);

  EXIT SUB;

end if;

According to this Code If the QVD is not Available then we are doing a Full Load.

Now what We have Changed is

If the QVD is Available and the No of Records in QVD is zero  then again it has to do full load. and also we need to show  the LastModifieddate.

i Have changed the code like this but i am getting lastmodifieddate is 0. Why?

if not isnull(QVDCreateTime('$(vQVDPath)IDS_$(tableName).qvd')) or ((exists('$(vQVDPath)IDS_$(tableName).qvd') and QvdNoOfRecords('$(vQVDPath)IDS_$(tableName).qvd')=0)) then

LoadTime:

Load Max(LastModifiedDate) as LastModifiedDate // Or max(CreatedDate)

From $(vQVDPath)IDS_$(tableName).qvd (qvd);

Let vLastExecTime = timestamp(peek('LastModifiedDate',0,'LoadTime'),'YYYY-MM-DD hh:mm:ss');

//Let LastModifiedTimestamp = '$(vLastExecTime)';

Drop Table LoadTime;

ELSE

  Call FullTableLoad(tableName);

  EXIT SUB;

end if;

1 Reply
Gysbert_Wassenaar

This won't check if a file exists: exists('$(vQVDPath)IDS_$(tableName).qvd')

Use the filesize() function. It will return 0 if the file was not found:


Let vFileSize = FileSize('C:\MyDir\MyFile.qvd');

If $(vFileSize)  = 0 then .... // file does not exist or its size really is zero bytes.



talk is cheap, supply exceeds demand