Navision Application Server 3.60 Questions

Hi, today i started testing NAS to check if we can use it for our purposes. I just finished reading the manual, but it isn’t very detailed. I hope you can help me: 1. Is it possible to uninstall the service that i can’t see it in services window anymore? (without uninstalling the program [:)]) 2. Do i need to setup Application Server Management Console or is it enough if i only run it from command line (i noticed that i didn’t need to start the service to be able to execute NAS from command line) 3. Can i use NAS without executing commmand line commands? 4. If i run NAS by command line, after executing job NAS console awaits a ESC to proceed. Isn’t it possible to start NAS and the console window closes itself after finishing job in Navision? 5. Is there any possiblity to transfer data out from Navision to another application? Maybe you know also some link or documentation about this topics. Thank you in advance, Stefan

maybe i should ask the other way: Is the main purpose of NAS just the possibility to start Trigger 99 with a parameter?

Hrmm… not sure I follow you but: NAS use the function 99 (look at properties for function in Globals) when logging in to Navision where it is supposed to run a codeunit in singleinstance, thus that cu will terminate when you stop the service. the cu will most commonly have some automation that gives you an event function by choosing “Withevents” at its (the variable of that automation) properties, most often Navisions Timer CPTimer.dll or Navision Communication Component and its bus adapters which will “event” on MSMQ/named pipe msg. regarding #5, there are many ways to dump information from Navision to external systems, reports, dataports or more less usual codeunits all with the help of a file object or some nefty outstream’s. regards /LG

thanks for answer … but i this isn’t exactly what i meant. Anyway what are you talking about in this sentence: “the cu will most commonly have some automation that gives you an event function by choosing “Withevents” at its (the variable of that automation) properties, most often Navisions Timer CPTimer.dll or Navision Communication Component and its bus adapters which will “event” on MSMQ/named pipe msg.” --------- I just wanted to knew how i have to use the NAS, if i want i.e. to run several reports (triggered over function 99 in CU 1) automated at a specific time without opening a console window. (or if i have to open a window, it should close without any user action) Currently i am using the Application Server this way: C:\Program Files\Navision Attain\Application Server>nas appservername=APPSRV001, servername=BAU260MAST, company=“Blum Navision Master”, startupparameter=p Then the service starts, the specified jobs in Navision are executed and after that any other command line commands can’t be executed (because the NAS service is started and blocks the license). Now how can i make that the service stops after executing the specified jobs in Navision??? Or is it possible to send commands to the running service? (without console window) I hope now it’s clear what i mean [:)]

Im guessing that what you want to is possible with NAS, but just going about it the wrong way. The standard way from what I have gathered would be to have NAS periodically poll a table for commands to run. When you have a job to submit, eg. running a report, the calling application creates a new line in the table with the details of what to do. NAS will periodically read this table looking for new jobs and process them. The good thing about this is that you can create lines in this table using Navision, or using C/FRONT if it is not Navision calling it. Im sure that if you look around in the previous postings, there will be details of other people that have done the same thing. I have set up something similar in the past for things such as report printing. It only requires about 3-4 codeunits to achieve. What LG (above) mentions is that you can set up NAS with a timer so that it will periodically perform actions (in the above case, the periodic action will be to poll a table looking for commands to run). It has to be single instance otherwise once its finished, it will close the codeunit and not run again. CU 5065 (email dispatcher) is a good place to start finding out more about this. Regards, Edward.

thx eddpeegs … i looked around in the forum and now i understand NAS better. Now i stand in front of another problem, how can i periodically poll with the NAS?? I tried to do it this way: REPEAT … SLEEP(xxx); UNTIL FALSE; This works but then it is impossible to stop the service. A working solution was creating NAS Server as Automation variable and adding this code to end of trigger: CREATE(NAS); NAS.ServiceStop(); In this case i suppose the service is restarting all the time (what’s no good solution in my opinion) Any other ideas?

Just encountered another strange problem: Trying to access most NAS Automation properties/methods causes an automation error. I thought there should be more compabiltity between Navision and NAS!! I tried to exit my infinite loop above by checking service status ← if service status is “stopping” then the loop should be ended.

I think that you may still be looking at the problem from the wrong angle. There shouldnt be any need to call NAS as an automation object nor should you have to use SLEEP(x) at any point. I do not have navision around to be able to copy and paste sample code, but the general method would be as follows: 1) NAS starts up with a parameter. This is passed to Function 99 on codeunit 1. As an example, lets say we pass the parameter ‘TEST’. 2) You will have added code in the Function 99 case statement that will look something like this: ‘TEST’: Codeunit.RUN(90000); 3) Codeunit 90000 is our dispatcher, which like LG above said, will be a single instance codeunit. It will also contain an automation object called “Navision Timer”. Set the property of the “With Events” automation variable to yes. When you do, a new function should appear, called summin like “Navision Timer::OnTimer”. 4) In the RUN trigger of your codeunit (90000), you will CREATE() the timer as you would any other automation variable, and you would would set some properties (or methods, I cant remember). One of these methods or properties will be called “interval”. This tells the navision timer how often it should run. 5) In the “Navision Timer::OnTimer” trigger, what you want to do is to put in a single line, such as the following: Codeunit.RUN(90001); Codeunit 90001 will contain the code that will scan a table looking for things to do. When it is finished it will terminate. 6) Create a table 50000 and call it Queue. Each line in this table will represent a task of some sort. There are many ways that you could design such a table, but the following should give you an idea: Entry No. – integer (PK) Open – Boolean Handling Codeunit – integer What codeunit 90001 will do is to scan this table with a filter on Open=Yes. If it finds any, it will call the handling codeunit to perform a task, then it will set “open” to false so it doesnt get run again. The handling codeunit would be something that carries out a task, such as running a report or posting a journal. In real life use, I would expect the queue table to be much more complete. For example you could add a second table called “Queue parameters” where you could pass Parameter/Value pairs so you can run reports with filters. Another table could be added called “Queue Errors” so that the handling codeunit can write errors down for you. etc. etc. From step 5 onwards, its up to you how you want NAS to behave based upon how you create the code to make it perform. Once set up as a service, there should be no need to shut down NAS, ever! If the nav server shuts down, NAS waits for it to start up then carries on. Its very reliable and Ive never come across any problems using it. Regards, Edward.

Very good info, added to my favorites, thank you…

Much thanks, this is really a great help!!! [:D]

Just came to another problem (sorry to be a pain [:D] ) 1. A external program should be able to start NAS with a parameter nas appservername=CAU0397-CLASSIC, servername=BAU260MAST, company=“Blum Navision Master”, startupparameter=blahblah so far so good … 2. now after processing this job the console window should close … but how as it always requests a ESC char to stop the NAS. Couldn’t this done somehow without user interference? Because otherwise its impossible to use this method for an automated job handling on server. ------------------------------------ PS: I know that the method with “Navision timer” and always running NAS is better, but i really want to know if i can use the server this way too, otherwise an external calling software has to make C/FRONT connection to NF for filling up NAS queue table.

Aaahaaaa :slight_smile: I think you should use this feature to run a specific report/whatever trigged by an external program: navision://client/run?database=c:%5Cprogram%5Cnavision%20attain%5Cclient%5C360%5Cdatabase.fdb%26company=CRONUS%20Sverige%20AB%26target=Report%20124%26view=SORTING(Field3)%26requestform=Nej%26servertype=NAVISION :slight_smile: [Edit] Put a report in reqfrm to choose Print or Preview, but go to Edit and Copy as link to try on your own system, since this post of mine might, but just might, be a bit cryptic [:D]

quote:


Originally posted by blum
Just came to another problem (sorry to be a pain [:D] ) 1. A external program should be able to start NAS with a parameter nas appservername=CAU0397-CLASSIC, servername=BAU260MAST, company=“Blum Navision Master”, startupparameter=blahblah so far so good … 2. now after processing this job the console window should close … but how as it always requests a ESC char to stop the NAS. Couldn’t this done somehow without user interference? Because otherwise its impossible to use this method for an automated job handling on server. ------------------------------------ PS: I know that the method with “Navision timer” and always running NAS is better, but i really want to know if i can use the server this way too, otherwise an external calling software has to make C/FRONT connection to NF for filling up NAS queue table.


What You normally do with NAS is to have it running all the time and send som kind of signal from Your external program. This signal could be a row in a table inserted with C/FRONT or C/ODBC, a file that has been created, a message in Message Queue, a call on a specific IP-port which NAS can listen on etc etc. If You have another database where this “signal” is created You can have NAS looking in a table in that database by using ADO. This is normally no problem as long as You don’t have a LOT of companies in Your database where You wan’t NAS to do things.

This is a dummy post to get the answers readable.

quote:

1. Is it possible to uninstall the service that i can’t see it in services window anymore? (without uninstalling the program [:)])

If you don’t find it in the services window, it isn’t installed.

quote:

2. Do i need to setup Application Server Management Console or is it enough if i only run it from command line (i noticed that i didn’t need to start the service to be able to execute NAS from command line)

You can start the NAS from the command prompt. You can also install it as a service from the command prompt. You can control starting/stopping the service from the command prompt.

quote:

3. Can i use NAS without executing commmand line commands?

Yes, installing the first instance of the NAS, for each extra NAS, you need to copy some files (I copy the whole subdir) and start/install as service from command prompt.

quote:

4. If i run NAS by command line, after executing job NAS console awaits a ESC to proceed. Isn’t it possible to start NAS and the console window closes itself after finishing job in Navision?

You can install the NAS as a service.

quote:

5. Is there any possiblity to transfer data out from Navision to another application?

-Well, you can use C/Front, C/ODBC. But with these you can’t use the business logic of Navision -You can open a Navision client and let it comport itself as a NAS. -You can let a user comport himself as a NAS [:)] More info you can find in document “w1w1atas.pdf”. You can find it on the Navision installation CD.