Hello. I am using NAS (not as a service, but from the command line). When I execute it, if there is an error in the code I get it in the DOS window (for example, bus. posting grup is missing in vendor XXX) and Nas does not close it enters in an endless loop retriying. Is there a way to tell NAS to to retry in case of error and just close?.
Thanks,
0
Comments
IF GUIALLOWED THEN
Error('errortext');
All depends on how your NAS is working... how the process is started, if there is some neverending loop, or there is some automation (timer etc.) which will fire trigger etc. Can you be more specific, how the NAS is working?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Kine. Our idea is having a Nas process wich is called from a bat file for different companies A and B. When Nas is executed, reads an Excel file and creates orders in the Company A, afther that the bat file executes again and then Nas is executed for company B where it also creates orders. Our problem is: if we have an error creating orders for company A, Nas is never called for company B as Nas is still open retrying execution for company A. It's a bit complicated to explain in few words. Thanks for your help.
- If you need to start nas from command line, I would prefer to have different services started and stopped with net start/net stop
- Have your code structured with a kind of master codeunit, starting the other codeunits with "if codeunitxy.run then..." This way you have a simple error handling. If you are on NAV 5.x you also have the getlasterror command to build a more advanced error handling and/or logging.
Thomas
Make sure you understand why it is there, and that you develop an alternative way to handle the situation that caused the error in the first place. If the error needs to be there then you need to find a different way to handle that for NAS.
RIS Plus, LLC
Best solution is to have separate NAS for each company (I know, it cost something, but may be it is cheaper than trying to solve the problem and possible problems connected to the solution).
Your problem is, that when error is called during NAS initialization (in NASHandler function of CU1), the NAS will try to reinitialize...
You need to finish the NASHandler without problem (e.g. by defining timer, runt it and the process call in the OnTimer trigger). But than you have rpoblem how to end the NAS, because there is no C/AL to stop it. But if it is running as service, you can stop it by running NET STOP command, and because the parameters are in registry, you can modify them from NAV to run with another company next time...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
The NAS is restarting if the NASHandler is ended with error. If there is no error, it continues in run until ended with ESC key or in another way.
Better is to run the NAS as service, because you can stop it through net stop command e.g. from C/AL code when all was done... and before that, you can change the parameters of the service by changing them in registry or by starting another instance of the NAS.
It means something like:
1) NAS1 starts
2) NAS1 finished, net stop NAS1, net start NAS2
3) NAS2 starts
etc...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.