Suffering from locks while showing message boxes?
pdj
Member Posts: 643
If the OnAfterGetRecord trigger of a report contains a MESSAGE and then a CurrReport.BREAK any locked tables will remain locking untill the user presses Ok. Sample code to reproduce the situation:
Is this expected (or even acceptable) behavior?
OBJECT Table 77777 Break Test
{
OBJECT-PROPERTIES
{
Date=10-06-09;
Time=14:45:47;
Modified=Yes;
Version List=;
}
PROPERTIES
{
}
FIELDS
{
{ 1 ; ;No. ;Integer }
{ 2 ; ;Description ;Text30 }
}
KEYS
{
{ ;No. ;Clustered=Yes }
}
CODE
{
BEGIN
END.
}
}
OBJECT Report 77777 Break Test
{
OBJECT-PROPERTIES
{
Date=10-06-09;
Time=14:49:05;
Modified=Yes;
Version List=;
}
PROPERTIES
{
ProcessingOnly=Yes;
}
DATAITEMS
{
{ PROPERTIES
{
DataItemTable=Table2000000026;
DataItemTableView=SORTING(Number)
WHERE(Number=CONST(1));
OnAfterGetRecord=BEGIN
BreakTest.LOCKTABLE;
BreakTest.FIND('-');
IF DoBreak THEN BEGIN
MESSAGE('Locking? - With BREAK');
CurrReport.BREAK;
END ELSE BEGIN
MESSAGE('Locking? - Without BREAK');
END;
END;
}
SECTIONS
{
{ PROPERTIES
{
SectionType=Body;
SectionWidth=12000;
SectionHeight=846;
}
CONTROLS
{
}
}
}
}
}
REQUESTFORM
{
PROPERTIES
{
Width=9020;
Height=3410;
}
CONTROLS
{
{ 1000000001;CheckBox;3410;0 ;440 ;440 ;ShowCaption=No;
CaptionML=ENU=Break (y/n);
SourceExpr=DoBreak }
{ 1000000002;Label ;0 ;0 ;3300 ;440 ;ParentControl=1000000001 }
}
}
CODE
{
VAR
BreakTest@1000000000 : Record 77777;
DoBreak@1000000001 : Boolean;
BEGIN
END.
}
}
Try creating a few records in the table, and execute the report with the checkmark. While the message box is shown you can check the table is locked from a different client. This could be the reason for users experiencing timeout without the SQL seems to be doing anything. Problem reproduced in 3.70-Native & 5SP1-Native & 5SP1-SQL.Is this expected (or even acceptable) behavior?
Regards
Peter
Peter
0
Comments
-
THis was fixed in one of the service packs in 4.00, but I think it resurfaced in a later version. Check out Waldo's blog I think he indicates the hot fix that fixes it.David Singleton0
-
I guess you are refering to this one: https://mbs.microsoft.com/knowledgebase ... wsignin1.0 which is released for both 4SP3 and 5 (but not for 5SP1 where it is expected to be included)
I don't have the code to reproduce the above problem, but I guess it is related to ERROR and not to the MESSAGE function. It might be the same bug, or at least very related. Neither ERROR nor MESSAGE should keep locks active.Regards
Peter0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 250 Dynamics CRM
- 102 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
