Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am trying to write a function for my loaders. What I am trying to do is that I take a date from a log file and once that date from the log file is the same as the current date then to run the rest of the script but if it doesn’t meet the current date it will keep checking the log until the date equals the current date.
So something like this:
Function runLoader()
If date = Today then run the rest of the script
Else keep checking the date
Does anyone know how I could go about this?
Any help is much appreciated,
Mckay
I think I understand. This problem is typically solved by triggering the reload externally from the job that creates the file. However, it could be done in script as you've asked like this:
DO until NoOfRows('logtable') > 0
Trace Reading log file;
logtable:
LOAD Date,
Message
FROM
logfile.txt
(txt, codepage is 1252, embedded labels, delimiter is ',', msq)
WHERE Date = Today(1)
;
Trace Sleeping...;
SLEEP 5000;
LOOP
-Rob
Is the "date" field you are checking a field in the log file? So you only want rows where the date = today?
-Rob
Hi Rob,
Thanks for the reply.
The log file contains a date once the job that generates the log has been completed.
I have created a loader to create QVD's but what I want to do is write a function so that it checks this log file and when the date in the log file is the same as the current date, the function stop and the rest of the script will run.
If you understand what I mean?
I think I understand. This problem is typically solved by triggering the reload externally from the job that creates the file. However, it could be done in script as you've asked like this:
DO until NoOfRows('logtable') > 0
Trace Reading log file;
logtable:
LOAD Date,
Message
FROM
logfile.txt
(txt, codepage is 1252, embedded labels, delimiter is ',', msq)
WHERE Date = Today(1)
;
Trace Sleeping...;
SLEEP 5000;
LOOP
-Rob
Hi Rob,
It's working perfectly- thanks alot.