error handling

stuarth
Member Posts: 16
Has anybody been able to handle Navision errors, without using NAS and timers?
If there is a way of closing the error dialog boxes automatically without user intervention and continuing with code execution using something developed in VB.NET perhaps?
Example code would be great
Thanks in advance.
If there is a way of closing the error dialog boxes automatically without user intervention and continuing with code execution using something developed in VB.NET perhaps?
Example code would be great
Thanks in advance.
0
Comments
-
Some functions in Navision has a parameter called "HideDialog" which will do something like this.
MyExampleFunction(SomeCodeVar : Code[10],HideDialog : Boolean); IF NOT HideDialog THEN MyRecord.GET(SomeCodeVar) ELSE IF NOT MyRecord.GET(SomeCodeVar) THEN // Do something other (exit or write into a log file, ...)
Sometimes you will find an additional function "SetHideDialog" or similar:SetHideDialog(NewHideDialog : Boolean); GlobalHideDialog := NewHideDialog; MyExampleFunction(SomeCodeVar : Code[10]); IF NOT GlobalHideDialog THEN MyRecord.GET(SomeCodeVar) ELSE IF NOT MyRecord.GET(SomeCodeVar) THEN // Do something other (exit or write into a log file, ...)
Timo Lässer
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]0 -
Forgive me for sounding stupid, but I have never noticed theses functions until now.
I see that this “Hidedialog” is used in the system mainly in codeunits, and reports and tables.
Can it be used in form where I click a button and try and assign a string value of say “this is a test” into a variable defined as type text[2], which would cause an error dialog “ overflow under under type convesion of text to text” to be displayed?
Here is the object in question
[code]
OBJECT Form 50067 test
{
OBJECT-PROPERTIES
{
Date=05/10/25;
Time=[ 2:53:38 PM];
Modified=Yes;
Version List=stuart;
}
PROPERTIES
{
Width=3300;
Height=1210;
}
CONTROLS
{
{ 1000000001;CommandButton;110;110;2200;550 ;CaptionML=ENU=test button;
OnPush=BEGIN
Txt_TestVariable := 'This is a test';
END;
}
}
CODE
{
VAR
Txt_TestVariable@1000000000 : Text[2];
BEGIN
END.
}
}
[code][/code]0 -
No, that is not possible.
If you want to avoid error messages, you (as developer) has to make sure, that all possible errors will be handled in any way.
For your example, you have to check the field length before assigning the value.MyTextVar := 'This is a test'; // Solution 1: Exit or write into a log file IF STRLEN(MyTextVar) > MAXSTRLEN(Txt_TestVariable) THEN EXIT; // WriteErrorLog('bla bla bla'); // Solution 2: Copy as much as you can: Txt_TestVariable := COPYSTR(MyTextVar,1,MAXSTRLEN(Txt_TestVariable);
Timo Lässer
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]0 -
Ok , fair enough(I guess I opened myself up to that one
), but I still wish there was some form a “try and catch” type functionality.
The actual reason for all of this (believe it or not) is because I am trying to run automated reports. Since I can’t use NAS to run reports, I tried using the scheduler to execute the fin.exe, which would load up an instance of navision on the server as a sort of background service. Navision would then load a form on startup which would run a timer and run predefined reports and save then as HTML files and then e-mail those reports.
This all worked fine except that if the report generated an error for whatever reason, the form that was executing the report would display an error dialog, even though I used the timmer.dll event error handler. This would stop code at that point and prevent logging the error and e-mailing that error of to me. If I click on the error dialog, then the code continues and the error is logged and emailed etc. Unfortualnely, as I am running this form using the scheduler as a sort of background service so there is no way of clicking on the error dialog.
So…what I would actually like to do is execute reports in NAS, which solve all of this nonsense.
I’m using NAV 3.01 by the way.0 -
Since Navision 3.60, the NAS IS capable of printing reports. This comes from the ChangesW1360.doc:P96) Reports on Navision Attain Application Server
Feature
Navision Attain Application Server is now able to run reports and does like the Navision Attain Client. However, there are the following differences:
• It does not have page setup.
• It does not have print preview.
• It will fail if you try to run a report with the request form.
• It will ignore the status dialog box.
Navision Attain Application Server can:
• Print a report.
• Run a batch report.
• Save a report as HTML.
• Save a report as XML.
So maybe you can do a technical upgrade to use the new NAS capabilities?No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0 -
Cool,
So that solves that proplem, except i only have Navision 4.0 and the asp ODBC scripting is less effiecent(by 10 - 40 seconds) in one of my SQL statements than ver 3.01 CODBC(belive it or not). - but thats something else to work on. Just Swings and roundabouts eh?!?
Thanks for all the help guys.0
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