I'm still having trouble with an app I have to check the presence of files (and their number and name) in a certain directory - that's just to make sure the correct nr. of files with the correct names is there because some other apps depend on that, and to send email_alerts to the responsibles if that is not the case.
One part of the code in this app is conditionalized to only run on Fridays - it checks a specific subdirectory where the files for the next week should always be stored, and it isn't reasonable to expect those files to be there before Friday. So I want the check to only run on a Friday.
What happened today - and the two last weeks - was that the code did not run on Fridays. When I go through it in the Debugger, it jumps straight to the ENDIF (at the very end of the tab), so the code inbetween is seemingly not being executed.
I can post the code here (I'll attach it) though it won't work for you, there is a number of filepath_variables involved.
Can anybody help me with that?
Thanks a lot!
Solved! Go to Solution.
That is it!
I just replaced that >> Weekday(Today(0)) << with NOW(0) - and it read 06:00:13 - though right now it is 09:20 ;-) So the parameter 0 does return the day of the last script_reload, not the current one.
I will try with the parameter 1 - for immediate evaluation.
that crossed my mind too - but I tested it both on the GUI (there the Weekday() fct did return 'Fri') and also in the script - I tested in a small test_app with just some arbitrary load in that same IF THEN clause - and that worked ... Now I'll try putting it in a qvs file for an INCLUDE - maybe there is too much happening inside that clause (there is a loop and some variables and whatnot)
If it is working fine for you locally but failing when run from the server, could it be an issue with server time settings?
When it ran on the server, it may not have been Friday for it and correctly skipped the code, maybe check the run on Thur/Sat
yes, that sounds good. The strange thing is, I tested it locally on Friday - and it worked fine. Then I tried starting the script through QMC - so it was run on the server - and that worked fine, too ...
It was the same the week before as far as I can remember.
So it cannot be that the server settings are generally different. Also, this app is run at 6am, so there can be no confusion about the day, either ...
The flipside of it also works - the code should not be run on any other day, and it isn't ...
Strangely, though, the closing ENDIF is not logged - the line with the IF THEN clause is in the log and from the next lines I can tell that the specific code for Fridays has been skipped. The ENDIF is not in the log, though ...
That is not normal, is it?
P.S.: I use Today(0) for the weekday_check - so it should be updated at reload of the script, no? And, as I said, the app is reloaded at 6am.
put several trace-statements in the script - inside and outside from if-loop - to check what your variables return and which statements are executed and which not.
that does sound quite strange.
QV version, is what you are running locally the same as the server?
The job starts at 6am? or it reaches that section of code at 6am? And that's 6am according to QMC not your local machine yea?
Today(0) means date at the script start time I believe, if the job starts before midnight and that code isn't reached until 6am, I think that might cause an issue.
Like Marcus says though, trace the whole thing and see what is/isn't showing