ExecuteEveryMinute on a shared db (Enterprise)

Admittedly I am new to this variable. My goal is to have a db on the server that automatically creates a new record every minute. (Reasons to be explained later if desired.)

On a file locally, I have written a procedure that creates a new record. I surrounded that with
Global ExecuteEveryMinute
ExecuteEveryMinute{ Add a record code goes here }

This works wonderfully while my file is open locally. But if I close my file locally but keep Pano 6 open, I get errors telling me that ‘Destination field does not exist’. Understandable as the file that contains that field is now closed. How can I not get those errors locally without keeping the file open as I’m really not wanting it to happen locally?
Edit: I’ve figured out that I can check for the MAC ID of the local computer and exit the procedure if I am running locally.)

Having shared that file and uploaded it to the Enterprise Server, I was hoping that it would by being open on the Server, that it would automatically create the new records. No such luck.

What is the proper way to accomplish the server automatically adding a new record every minute?

Instead of checking for the MAC ID, I would suggest checking to make sure that the file is open. Also, your code is going to need to make sure that the correct window is open before it starts adding records. Otherwise it will just be adding records to whatever database happens to randomly be the top window – which is almost certainly a BAD thing.

As for this running automatically when you open it on the server – where is the code that defines the variable? If it is in the .Initialize procedure, that doesn’t get run on the server. Instead, you need to set up a procedure named .InitializeServer.

I don’t have time to check this right now, but it is possible that the server itself uses the ExecuteEveryMinute variable. So if it does, you will be stopping the server from doing periodic tasks. I think it might be using this for periodic backups, so you are probably ok if you haven’t enabled those. But I am not sure about that. This is part of why Panorama X has a new system for running code periodically, which allows different tasks to run periodic code independently without interfering with each other. But of course that won’t help you at the moment.

I had a similar need and solved it a completely different way. Instead of running a timer locally, I set up an external monitoring service that “pings” the server periodically with a URL of my choosing. I set up a URL that runs a Panorama procedure with my periodic task. If once every 5 minutes is enough, you can find free services for this. If you really need once a minute you’ll probably have to pay a few dollars a month. As a bonus, these services can also notify you if there is no response, so you’re also getting downtime alerts if there is any problem with the server, the network, or Panorama. The whole system has been in use for over a year and works great. I actually set up 2 external monitoring services for redundancy.

LOL. I’m essentially doing what you did in reverse. In my case, I have multiple pieces of equipment at an unattended remote site that are needing to be running 24x7. I have programmed a computer at the remote site to send a custom URL to Enterprise with the statuses of each of those processes embedded in the URL as extra cgi parameters. That URL triggers a procedure adding the custom record every minute when it receives the hearbeats. Those will ultimately be the heartbeat signals that Enterprise will then analyze and if any of the processes is a ‘0’ instead of a ‘1’, my Enterprise will then send out notification texts based on time of day and person responsible.

But at the moment, I am just needing Enterprise to be creating some phony records on a minute basis so that I can have another procedure check the results and the timing or lack of records while I write my notification procedures.

It is not a variable that does not exist but rather the lack of the field that is needing to be written to to create the appropriate record on my local computer as the file is closed. As it is a shared file, when I have it open locally for local programming, I am not wanting it to be adding records; nor do I want it to run the procedure when I have the file closed. Checking the MAC ID allows me to work on the file and not have records created.

So my main question remains, can Enterprise by having the file ‘open’ for serving, be enough to get records created, or do I have to have a client Panorama 6 run on the server with the file manually opened to get my records created? Just having it open on the server does not seem to do anything at all. No records get added. Only if I manually use a Client copy on the Server am I able to get records created. Would that ExecuteEveryMinute interfere with the Enterprise’s variable? And is there a way to have the Server’s ‘open’ copy be adding records?

Robert Ameeti

.InitializeServer will definitely allow you to set up ExecuteEveryMinute to add a record. Just be sure to include serverbackupcheck.

So you’d end up with something like:

ExecuteEveryMinute = {OpenServerFile "TheDB"
If Error

FWIW, I have series of processes that run during the night that are loaded into an ExecuteEveryHour. When the date changes, or a specified hour arrives, the first task in the list runs by being assigned to ExceuteEveryMinute. When completed, it’s success is noted in a variable so that it gets excluded in the next hour, allowing the next task in the list to run then. Once they’re all done ExecuteEveryHour goes back to monitoring the date and time to watch for when its due to run the “chores” again.

I was asked abut where I found ExecuteEveryHour. I failed to make clear that it’s my own creation and not a Panorama statement.

It’s easy to create though. For instance:

Global ExecuteEveryMinute, ExecuteEveryHour
ExecuteEveryHour = {Message "X"}
ExecuteEveryMinute = |||
    Local lvCheck 
    lvCheck = timepattern(Now(),"mm")
    If val(lvCheck) < 01 
        Execute ExecuteEveryHour 

This is clearly a simplified example. In my own uses I build ExecuteEveryHour as a variable exactly as I would build an ExecuteEveryMinute and call it with Execute ExecuteEveryHour. It could alternately be a called procedure instead of a variable; Call ExecuteEveryHour.

Similarly you could set up any time interval based on minutes, hours or days. And of course you could name ExecuteEveryHour anything else that works for you. I’ve prefered to stick with the Execute naming convention since it readily identifies them for me.

For me, ExecuteEveryDay does backups and other chores when ExecuteEveryMinute detects a date change

The one potential problem I see with this is that it assumes that ExecuteEveryMinute will always run during the first minute of the hour. While this will usually be true, it is not 100% guaranteed, and if it doesn’t, you could miss an hour. If that could be a problem, I would change the logic so that it keeps track of the hour in a global variable, and then runs this code when the hour changes. That would absolutely guarantee that it would be called every hour.