Hi Guys,

I have to do a solution for a event which fires at every 500 millisecond. I need a solution which i can use to check if the function has run once for a purticular day. If i use a static variable it becomes out of scope and as such gets reinitialised every time the event executes. What can i use to solve this.

Thanks in advanced.

If i use a static variable it becomes out of scope

I'm not sure what you mean by that. Do you have some simple example code we could use to reproduce your problem?

Well the function im using is rather too complex so too big to post so im gona use runReport() to refer to the function.

I basically have to auto schedule the function for a day as specified by the user. Say the user specifies thursdays at 11.00 am

So basically my question is how can I automatically run the function runReport() at the specified time and day.

The way i did it was to check which day it is then check what time it is on timer event handler. The problem with that is say i need to run at 11.05. The timer event runs every 500 millisecs. So basically what im guessing is between 11.05 and 11.06 there is alot of millisecs which means the function runReport() runs more than once.

I basically need a better way or somehow i can track if the function has already run.

The solution is to store the fact that the process ran (or is running) somewhere (database, text file, in memory) and then runReport() checks that value after it determines the time is right but before it starts actual processing.

An SSCCE that illustrates what you're doing would still be useful--knowing the type of application and how you're trying to solve your problem will help us help you.

Depending on your needs, it may be simpler to write runReport as a simple application, and use a job scheduler to actually run it--unless you want the experience of writing a scheduler yourself.