NAV Timer

Kc_Nirvana
Member Posts: 146
Hello,
Is it possible to use NavTimer.DLL from Navision 2009R2 in Nav2013R2 with NAS?
Thank you
Is it possible to use NavTimer.DLL from Navision 2009R2 in Nav2013R2 with NAS?
Thank you
Junior Consultant & Developer in Dynamics NAV
"I'm worse at what I do best
And for this gift I feel blessed
Our little group has always been
And always will until the end"
Nirvana - Nevermind - Smells Like Teen Spirit
"I'm worse at what I do best
And for this gift I feel blessed
Our little group has always been
And always will until the end"
Nirvana - Nevermind - Smells Like Teen Spirit
0
Answers
-
Not sure about using the old 2009 version, but there's a new timer DLL in the "RoleTailored Client\Add-ins\Timer" folder named "Microsoft.Dynamics.Nav.Timer.dll".
We've done some recent work with this DLL and NAS and it seems to work just fine.0 -
You should really try to use WHILE Loops and SLEEP instead of the timer.________________________________
Gunnar Gestsson
Microsoft Certified IT Professional
Dynamics NAV MVP
http://www.dynamics.is
http://Objects4NAV.com0 -
That doesn't make any sense. The timer is used to implement completely different functionality than WHILE loops and SLEEP calls in code.Rob Hansen
http://www.epimatic.com0 -
Hi,
NAV 2013 has a new addin called PingPong which does the same as timer would (in my understanding).
http://www.dynamics.is/?p=1311
Marcell0 -
majormarcell1988 wrote:Hi,
NAV 2013 has a new addin called PingPong which does the same as timer would (in my understanding).
http://www.dynamics.is/?p=1311
Marcell
The issue we found with this is that the PingPong control works great as a client side control, but it will not run server side, which is required for running with the NAS.0 -
daborg wrote:majormarcell1988 wrote:Hi,
NAV 2013 has a new addin called PingPong which does the same as timer would (in my understanding).
http://www.dynamics.is/?p=1311
Marcell
The issue we found with this is that the PingPong control works great as a client side control, but it will not run server side, which is required for running with the NAS.
And that's my problem...
I am migrating a NAV5 to a NAV7 and I used the NAV Timer 1.0 on NAS.
The timer problem on NAS, it was solved by JobQueue but I still have one problem with the error handling.
On NAV5 with Timer, when it gave an error they go to TimerError and rollback transaction even codeunits with Commit...
Right now IF I try to Post a GenJnlLine and gives error, the line stay on the journal.....Junior Consultant & Developer in Dynamics NAV
"I'm worse at what I do best
And for this gift I feel blessed
Our little group has always been
And always will until the end"
Nirvana - Nevermind - Smells Like Teen Spirit0 -
I would solve this with three codeunits and a parameter table
1. Timer Codeunit
2. Execution Codeunit
3. Loggin Codeunit
You need a parameter table like "Job Queue Entry"
The Timer Codeunit would be something like thisWHILE TRUE DO BEGIN SuccessfulExecution := CODEUNIT.RUN(Codeunit::"Execution Codeunit",ParameterTable); IF NOT SuccessfulExecution THEN BEGIN ParameterTable.WasError := TRUE; ParameterTable.SetErrorMessage(GETLASTERRORTEXT); END; SuccessfulExecution := CODEUNIT.RUN(Codeunit::"Logging Codeunit",ParameterTable); SLEEP(2000); // Wait 2 seconds for next loop END;
You start the timer codeunit using STARTSESSION command.
In the execution codeunit you select what to do and returns all that needs to be logged via the parameter table.
But
What I do in real life is create a report and add that report to the Job Queue.
In the report I execute a codeunit with error handling and logging.________________________________
Gunnar Gestsson
Microsoft Certified IT Professional
Dynamics NAV MVP
http://www.dynamics.is
http://Objects4NAV.com0 -
I suggest to use Jobqueue. You can schedule to trigger a codeunit based on a time.0
-
thegunzo wrote:I would solve this with three codeunits and a parameter table
1. Timer Codeunit
2. Execution Codeunit
3. Loggin Codeunit
You need a parameter table like "Job Queue Entry"
The Timer Codeunit would be something like thisWHILE TRUE DO BEGIN SuccessfulExecution := CODEUNIT.RUN(Codeunit::"Execution Codeunit",ParameterTable); IF NOT SuccessfulExecution THEN BEGIN ParameterTable.WasError := TRUE; ParameterTable.SetErrorMessage(GETLASTERRORTEXT); END; SuccessfulExecution := CODEUNIT.RUN(Codeunit::"Logging Codeunit",ParameterTable); SLEEP(2000); // Wait 2 seconds for next loop END;
You start the timer codeunit using STARTSESSION command.
In the execution codeunit you select what to do and returns all that needs to be logged via the parameter table.
But
What I do in real life is create a report and add that report to the Job Queue.
In the report I execute a codeunit with error handling and logging.
I had this code in NAV 5 that I can't seem to be running in NAV 2013
Codeunit single instancegautTimer::Timer(Milliseconds : Integer) gcunInterfaceADO.StartConnection; //######################### Copy Transactions to Navision Tables gcunInterfaceADO.CopySQLNAV('SP_NAVReadTransaction'); //######################### Process Entities IF grecInterfaceSetup."Entities Interface" THEN gcunInterfaceGeneral.ProcessEntitiesNAV; //######################### Process Dossiers IF grecInterfaceSetup."Dossiers Interface" THEN gcunInterfaceGeneral.ProcessDossiersNAV; //######################### Process Expenses IF grecInterfaceSetup."Expenses Interface" THEN BEGIN gcunInterfaceGeneral.ProcessExpensesSQL; gcunInterfaceGeneral.ProcessExpensesNAV; END; //######################### Process Mov. IF grecInterfaceSetup."Mov. Interface" THEN BEGIN gcunInterfaceGeneral.ProcessMovNAV; gcunInterfaceGeneral.ProcessImp; END; gcunInterfaceADO.CloseConnection; //######################### Process Expenses IF grecInterfaceSetup."Expense Interface" THEN BEGIN goptOrigin := goptOrigin::Expense; gcunInterfaceADO.StartConnectionExpense; gcunInterfaceADO.CopySQLNAVExpense('SELECT * FROM PortalVdA_View_NAV_Despesa'); gcunInterfaceADO.CloseConnection; END; gautTimer::TimerError(ErrorString : Text[1024]) IF goptOrigin = goptOrigin::Juris THEN gcunInterfaceADO.ProcessTransactionSQLNAV2(gintTransactionNo,'SP_SQLNAVTransactionModify',ErrorString) ELSE IF goptOrigin = goptOrigin::Nav THEN gcunInterfaceADO.ProcessTransactionSQLNAV2(gintTransactionNo,'SP_SQLNAVTransactionModify_NAV',ErrorString) ELSE IF goptOrigin = goptOrigin::Expense THEN gcunInterfaceADO.ProcessExpenseSQL(gcodExpense,2,ErrorString); //ERROR(ErrorString);
I had ADODB automation which I replaced with DOTNET variables SQL...
But it seems that if I put the one codeunit on single instance and run your code it only runs 1 time....Junior Consultant & Developer in Dynamics NAV
"I'm worse at what I do best
And for this gift I feel blessed
Our little group has always been
And always will until the end"
Nirvana - Nevermind - Smells Like Teen Spirit0 -
You can study how the Job Queue works in standard NAV.
In Codeunit 448 you will find the codeWHILE JobQueue.Started DO BEGIN HandleRequest; COMMIT; JobQueue.LOCKTABLE; IF NOT JobQueue.GET(JobQueue.Code) THEN EXIT; IF NOT JobQueue.Started THEN EXIT; IF NOT (JobQueue."Session ID" = SESSIONID) THEN EXIT; JobQueue.UpdateHeartbeat; COMMIT; SLEEP(10000); END;
Again I suggest that you use report to do the error checking for you codeunit and add the report to the standard job queue.________________________________
Gunnar Gestsson
Microsoft Certified IT Professional
Dynamics NAV MVP
http://www.dynamics.is
http://Objects4NAV.com0 -
thegunzo wrote:You can study how the Job Queue works in standard NAV.
In Codeunit 448 you will find the codeWHILE JobQueue.Started DO BEGIN HandleRequest; COMMIT; JobQueue.LOCKTABLE; IF NOT JobQueue.GET(JobQueue.Code) THEN EXIT; IF NOT JobQueue.Started THEN EXIT; IF NOT (JobQueue."Session ID" = SESSIONID) THEN EXIT; JobQueue.UpdateHeartbeat; COMMIT; SLEEP(10000); END;
Again I suggest that you use report to do the error checking for you codeunit and add the report to the standard job queue.
Why report and not codeunit?Junior Consultant & Developer in Dynamics NAV
"I'm worse at what I do best
And for this gift I feel blessed
Our little group has always been
And always will until the end"
Nirvana - Nevermind - Smells Like Teen Spirit0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions