Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Is there a way of creating a warning in my QV application so that, should any of the several csv exports I have fail, then it will create a warning message/flag.
I had an issue recently whereby a couple of the csv files were not generated, but I did not know anything about this until it was raised to me.
Thanks guys!
Hi Simon,
as far as I understand you're creating csv exports in the script ?
If so, what do you mean by fail ? The file is not created ? The file is empty ?
If the file is not created, you could create a for each loop with fileexist('yourfile'). If the file exists the script will enter the loop and you can set a variable that says that your file was created.
If the variable is not set then log it and exit gracefully or engage corrective action.
It the file is created, load it into a temporary table, check its number of rows compared to what is expected.
If it fails then log it and exit gracefully or engage corrective action.
Would that work ?
Loic
maybe checking if the file exists?
IF len(FileSize('somefile.csv')) > 0 THEN
trace 'found';
else
trace 'not found';
ENDIF;
Hi Loic,
Thank you for getting back to me so quickly.
Yes, I am creating csv's which are output to a location where this is picked up by FTP.
The csv files are generated each week, on a Monday and are post-fixed with the date of the file - eg: FILENAME-DDMMYYYY.csv (TXT);
In my scenario, the files were not generated one Monday, so I wondered if, in case this happened again, I could create a warning message or flag.
If I understand you correctly, are you suggesting to create a loop so if the csv files have been generated, then exit gracefully, but if they haven't, then to engage corrective action?
Hi - thanks for getting back to me.
I have tested this and it returns 'no found' even though a csv file has been generated - odd!
This might work - I'll have a think.
Thanks
Following on from Massimo's answer, it got me thinking...
Is it possible for Qlikview to send a warning email to a person/people/group if the csv has not been generated - I'm thinking it may be linked to
IF len(FileSize('somefile.csv')) > 0 THEN
trace 'found';
else
trace 'not found';
ENDIF;
Then if result is 'not found' to send the warning email?
Hi - I have found this link which may help me - thanks again for your responses guys.
in my test I get found / not found, below the script I used
directory;
t:
load * inline [
RevenueCategory, Sales
Category 1,50
Category 2,40
Contracts,110
];
store t into t.txt;
// this returns found
IF len(FileSize('t.txt')) > 0 THEN
trace 'found';
else
trace 'not found';
ENDIF;
// this not fund
IF len(FileSize('notexists.txt')) > 0 THEN
trace 'found';
else
trace 'not found';
ENDIF;
Here you have an example to export to csv.