Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
JackRen3
Contributor II
Contributor II

Creating a QVD with the reloading times of different applications

Hello everyone,

I hope you are all doing well. I am facing an issue with my Qlik application, and I need some help from the community. The application is intended to update the timestamp for a specific vCurrentAppName in a QVD file. However, the code does not seem to update the entry for the vCurrentAppName, and it remains as when it was first inserted.

Here is the relevant part of the code:

```
LET vQVDPath = 'lib://$(vDataConnectionFolder)/PVC_ReloadingData_dev.qvd';
LET vCurrentAppName = DocumentTitle();

// Load data from QVD file
PVC_Reloading_Info:
LOAD
ApplicationName,
LastTimeReload
FROM $(vQVDPath) (qvd);

// Check if the application already exists in the QVD file
LET vAppFound = 0;
FOR EACH vApp IN FieldValueList('ApplicationName')
IF vApp = '$(vCurrentAppName)' THEN
LET vAppFound = 1;
EXIT FOR;
END IF;
NEXT vApp;

// Update or insert the row based on the search result
IF NOT EXISTS('$(vQVDPath)') OR vAppFound = 0 THEN
// If the QVD file does not exist or the application is not present, create a new row with the application name and current timestamp
PVC_Reloading_Info:
LOAD
'$(vCurrentAppName)' AS ApplicationName,
Timestamp#(Now(), 'DD/MM/YYYY hh:mm:ss[.fff]') AS LastTimeReload
AUTOGENERATE (1);

STORE PVC_Reloading_Info INTO $(vQVDPath);
ELSE
// Otherwise, update only the timestamp for the current application
PVC_Reloading_Info:
LOAD
ApplicationName,
IF(ApplicationName = '$(vCurrentAppName)', Timestamp#(Now(), 'DD/MM/YYYY hh:mm:ss[.fff]'), LastTimeReload) AS LastTimeReload
WHERE ApplicationName = '$(vCurrentAppName)';

STORE PVC_Reloading_Info INTO $(vQVDPath);
END IF;
```

I've noticed that the timestamp does not get updated for the specific vCurrentAppName, and I'm not sure why this is happening. I expected the code to update the timestamp each time the application reloads, but it seems to be stuck with the initial timestamp.

Has anyone encountered a similar issue or could help me understand what might be going wrong? Any suggestions or insights would be greatly appreciated.

This portion of code will be integrated into different Qlik Sense applications, and then I will read this QVD file from a new Qlik application that will serve as a monitoring overview application.

Thank you in advance for your assistance!

Best regards

Labels (3)
3 Replies
marcus_sommer

It looked a bit more complicated as necessary. To get the wanted information you may just use file-functions like:

filetime() or qvdcreatedtime()

JackRen3
Contributor II
Contributor II
Author

Hello Marcus, thank you for your reply!

I will certainly implement those functions. Do you know how to update the qvd file with the latest timestamp if the ApplicationName is already in the QVD?

marcus_sommer

By a quick glance I didn't notice this issue but I would assume that not writing itself failed else it wasn't executed because the applied conditions within the for + if loops didn't reached this branch. To track such issues it's quite helpful to comment all measurements within the loops and applying msgbox or here in Qlik writing the steps from each branch within an extra table, with information like:

t: load 'Step X' as Step, $(i) as Iterator, '$(var)' as Var, now() as Timestamp autogenerate 1;

Afterwards you could easily track how often the loops run and which parameter-values exists and when it happens.