How to join NAS and Timer?

arcullarcull Member Posts: 191
Hi guys. I am trying to schedule som data processing inside nav W1 4.0 SP2 and I thought to use NAS for this purpose. So I Installed the NAS that comes along with the nav installation and configured it in mmc as follows:

Database Server Name=<blank>, because I,ll use a local database
Database= <full path to the database>
Company Name= <The company I want to use inside db>
Start-Up Parameter=<SBA>
Net Type=<TCP/IP>
Object Cache Size (KB)=<8000>

Then I added a line of code in CU 1 which will run my test CU. The line loooks like this:
SBAHandler.RUN;
ParamStr := UPPERCASE(NASID);
REPEAT...

My CU SBAHandler looks like this:
Documentation()

OnRun()
{IF ISCLEAR(NavisionTimer) THEN
  CREATE(NavisionTimer);

NavisionTimer.Interval := 5000;
NavisionTimer.Enabled := TRUE;}

IF ISCLEAR(CPTimer) THEN 
CREATE(CPTimer); 
IntervalInSek := 5;
CPTimer.Start(IntervalInSek);

NavisionTimer::Timer(Milliseconds : Integer)
MESSAGE('Time is %1',TIME);

NavisionTimer::TimerError(ErrorString : Text[1024])

CPTimer::CountDown(VAR intNextInterval : Integer)
intNextInterval := IntervalInSek * 1000; 
MESSAGE('Clock is %1',TIME);

The cu is sigle instance and if I run it manualy I get the message every 5 sec, with both timers 'Navision Timer 1.0'.Timer and 'CP Timer'.cCountDown it works ok. But when I close the database and theck the Event Viewer to see the messages, there is none. I get just warnings every 30 sec, saying that with the startup parameter <SBA> no service can be run. Looks like the timer event in my CU doesnt fire, because if I add the message in my CU in the OnRun trigger insted of in the CPTimer, I do get the message in the event log, but just every 30 sec, which I gues is the windows interval that runs the service, and that is not what I want. I have 10 application servers in licence. What could be wrong. Any suggestion welcome. Thanks.

Comments

  • DenSterDenSter Member Posts: 8,305
    That means that your NAS doesn't even start. If it starts correctly, there will be a message in the event viewer that says something like "NAV Application Server started successfully" and then lists the startup parameter. So at this point looking at your code is a complete waste of time, because NAS doesn't even get that far. First you will need to make sure that the NAS service has the right permissions, and set the right parameters.

    Read the document called 'w1w1ATAS.pdf' in the doc folder on your product cd, and see if you can find the section that covers how to set up the NAS user, the one that runs the service.
  • garakgarak Member Posts: 3,263
    edited 2008-11-07
    First you can debug your NAS to see whats wrong

    viewtopic.php?t=23939

    second
    the error message "saying that with the startup parameter <SBA> no service can be run" means, that you has as Startupparameter "SBA" but in function NASHandler on CU1 there is no snippes of code where the SBA is used. And i hope that you use the local database without server only for tests. Because on a local database can only one connection established.

    So when you do following in function NasHandler you have no problems.
    NASHandler()
    ...
    
      IF CGNASStartedinLoop = FALSE THEN
        CASE Parameter OF
          .....
          'SBA': //<--- this you must add in the case construct
            codeunit.run(50000); //or SBAHandler.run
        end; //cas end
    

    Regards.
    Do you make it right, it works too!
  • KYDutchieKYDutchie Member Posts: 345
    Hi,

    Are you configuring your NAS to log into a Native Database, *fdb file, without going through a Navision Database server?
    If so, the NAS will not be able to log into that database when you are logged in using a client.

    If you don't logon using the Navision Database server or SQL then you can only have one connection to the database at a time.

    Hope this helps,

    Willy
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
  • arcullarcull Member Posts: 191
    garak, KYDutchie thanks for your replies. I didn't know that I can debug NAS, in debug mode I have found out the source of my problem. Everything was setup ok, except a line of code in cu 1, that was missing
    CGNASStartedinLoop := TRUE;
    
    after runing my test CU, now it works like charm :)
Sign In or Register to comment.