Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

qvdcreatetime returns false info if file is in use by other load

I am using the qvdcreatetime function to check whether a certain QVD file exists and depending on the result, perform a load or skip (next loop).

My QV app loads data (QVD files) from different copanies and within each company several years are loaded by using for next statements for both companies and years. As not all years exist for each company, you can easily check whether a load for a certain company/year should be performed Y/N using the function above.

However, I have 2 QV apps that are both using the same QVD files (not all but certain) and these reload processes are running simultaneously. This should not cause any problem as the reload of the data itself (QVD) has been performed before.

But guess what : when my first app is loading the data in memory, the qvdcreatetime function apparently returns a <null> value during this load.

Is there any way to avoid this or should I use another command to check this ?

Underneath, you can find the proof (coming from the .qvw.log files)

1) First app reading

18/10/2011 5:51:47: 0265        LET vQVD_exists = qvdcreatetime('..\QVD\Accounting\BalanceSheet_03_2011.qvd')

18/10/2011 5:51:47: 0267        If len('2011-10-18 04:31:54') <> 0 then

18/10/2011 5:51:47: 0270          tt_BalanceSheet:

18/10/2011 5:51:47: 0271              LOAD

18/10/2011 5:51:47: 0272                  key_BS_account_number                        as key_BS_account,

18/10/2011 5:51:47: 0273                  key_BS_inter_company                        as key_BS_inter,

18/10/2011 5:51:47: 0274                  BS_account_number_type,

18/10/2011 5:51:47: 0275                  key_BS_period_AY                            as key_period_AY,

18/10/2011 5:51:47: 0276                  key_BS_currency_cnv,       

18/10/2011 5:51:47: 0277                  sum(BS_amount_system_currency)                as BS_amount_system_currency,

18/10/2011 5:51:47: 0278                  sum(BS_amount_ytd_system_currency)            as BS_amount_ytd_system_currency    

18/10/2011 5:51:47: 0279              FROM ..\QVD\Accounting\BalanceSheet_03_2011.qvd (qvd)

18/10/2011 5:51:47: 0280              GROUP BY

18/10/2011 5:51:47: 0281                  key_BS_account_number,

18/10/2011 5:51:47: 0282                  key_BS_inter_company,

18/10/2011 5:51:47: 0283                  BS_account_number_type,

18/10/2011 5:51:47: 0284                  key_BS_period_AY,

18/10/2011 5:51:47: 0285                  key_BS_currency_cnv       

18/10/2011 5:51:47: 0286             

18/10/2011 5:53:29:                   7 fields found: key_BS_account, key_BS_inter, BS_account_number_type, key_period_AY, key_BS_currency_cnv, BS_amount_system_currency, BS_amount_ytd_system_currency, 46.532 lines fetched

2) 2nd app reading the same file

18/10/2011 5:52:20: 0356      LET vQVD_exists = qvdcreatetime('..\QVD\Accounting\BalanceSheet_03_2011.qvd')

18/10/2011 5:52:20: 0358      If len('') <> 0 then

Look at the timestamps. The first app checks the QVD at 5:51:47 and loads the data (using a group by) untill 5:53:29

The 2nd app checks the QVD at 5:52:20 and returns <null>. As an intermediate solution, I have scheduled both reloads separately at this moment. However, the main reason for building QVD files is that you create these files once and use them in many apps so each app is based on exactly the same data set. In my case I am missing a full year of data.

2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

I assume that QVDCreateTime needs to open the QVD to retrieve the time from the XML header in the QVD file. It would appear that it cannot do so if the QVD is being read by another application, so returns null.

One possible workaround is to use the FileTime function, which returns the Windows last modified time.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Hi Jonathan,

Are you sure that the filetime function does not need to open the file and thus files can be accessed by more than 1 application using that function ? The QVDcreatetime doesn't allow you. I have had multiple occurrences now where a QVD file was not read / loaded because it was in use by another application.