Is RecRef.SETPOSITION broken in 2013r2?

DanK
Member Posts: 34
I'm getting an error in 2013R2; "The server "DynamicsNAV71" was unable to process the request. The application will close."
It's being caused by code which is working fine in NAV2013, for example:
Anyone else getting the same issue?
Event log:
It's being caused by code which is working fine in NAV2013, for example:
aRecordVar.FINDFIRST; recref.open(DATABASE::TableName); recref.SETPOSITION(aRecordVar.GETPOSITION); recref.FINDFIRST;
Anyone else getting the same issue?
Event log:
Type: System.ArgumentException Message: An item with the same key has already been added. StackTrace: at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at Microsoft.Dynamics.Nav.Runtime.NCLMetaTable.<TryGetFieldByCaption>b__e(Int32 lcid) at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) at Microsoft.Dynamics.Nav.Runtime.NCLMetaTable.TryGetFieldByCaption(String name, NCLMetaField& result) at Microsoft.Dynamics.Nav.Runtime.NCLMetaTable.FindFieldMatch(String fieldIdentifier, Boolean prefixFallback) at Microsoft.Dynamics.Nav.Runtime.TableFilterResolver.AddFilter(String fieldName, NCLMetaFilterType filterType, String expressionString) at Microsoft.Dynamics.Nav.Runtime.TableViewParser.ProcessWhere(String input, Match match, TableFilterResolver resolver) at Microsoft.Dynamics.Nav.Runtime.RecordImplementation.SetPosition(String position) at Microsoft.Dynamics.Nav.Runtime.NavRecord.ALSetPosition(String position) at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit61800.OnRun_Scope.OnRun() at Filter.InvokeWithFilter(NavMethodScope ) at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit61800.OnRun(INavRecordHandle εrec) at Microsoft.Dynamics.Nav.Runtime.NavCodeunit.DoRun(DataError errorLevel, NavRecord record) at Microsoft.Dynamics.Nav.Runtime.NavCodeunit.InvokeRun(Int32 objectId, Object[] args) at Microsoft.Dynamics.Nav.Service.NSCodeUnit.RunCodeunit(CodeUnitResponse codeUnit) at Microsoft.Dynamics.Nav.Service.NSCodeUnit.Invoke() at SyncInvokeInvokeApplicationMethod(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at Microsoft.Dynamics.Nav.Service.ServiceOperationInvoker.ErrorMappingCombinator(ServiceOperation innerOperation, NSServiceBase serviceInstance, Object[] inputs, Object[]& outputs) Source: mscorlib HResult: -2147024809
0
Answers
-
Hi Dank,
I've tested your code with GLSetup and works fine with Codeunits in NAV 2013 R2 W1.OBJECT Codeunit 80000 Test Mibuso { OBJECT-PROPERTIES { Date=08/10/13; Time=15:40:03; Modified=Yes; Version List=amazan; } PROPERTIES { OnRun=BEGIN GLSetup.FINDFIRST; recref.OPEN(DATABASE::"General Ledger Setup"); recref.SETPOSITION(GLSetup.GETPOSITION); recref.FINDFIRST; MESSAGE ('finished'); END; } CODE { VAR recref@1000 : RecordRef; GLSetup@1001 : Record 98; BEGIN END. } }
Greetings0 -
Hi Amazan,
Thanks for testing it out.
This error seems to be happening with some but not all tables, still trying to find some commonality between them.
Dan.0 -
DanK wrote:Hi Amazan,
Thanks for testing it out.
This error seems to be happening with some but not all tables, still trying to find some commonality between them.
Dan.
Hi
I tested a NAV2013r2 Italian database and this works fine:Window.OPEN('#1#############################'); Object.SETRANGE(Object.Type, Object.Type::TableData); Object.SETFILTER(ID, '..49999|99000000..'); IF Object.FINDSET THEN REPEAT TextLine := ''; Window.UPDATE(1, Object.Name); RecRef.OPEN(Object.ID, FALSE, Object."Company Name"); IF RecRef.FINDFIRST THEN TextLine := RecRef.GETPOSITION; RecRef.CLOSE; IF TextLine <> '' THEN BEGIN RecRef2.OPEN(Object.ID, FALSE, Object."Company Name"); RecRef2.SETPOSITION(TextLine); RecRef2.CLOSE; END; UNTIL Object.NEXT = 0; Window.CLOSE;
MatteoReno Sistemi Navision Developer0 -
matteo montanari wrote:DanK wrote:Hi Amazan,
Thanks for testing it out.
This error seems to be happening with some but not all tables, still trying to find some commonality between them.
Dan.
Hi
I tested a NAV2013r2 Italian database and this works fine:Window.OPEN('#1#############################'); Object.SETRANGE(Object.Type, Object.Type::TableData); Object.SETFILTER(ID, '..49999|99000000..'); IF Object.FINDSET THEN REPEAT TextLine := ''; Window.UPDATE(1, Object.Name); RecRef.OPEN(Object.ID, FALSE, Object."Company Name"); IF RecRef.FINDFIRST THEN TextLine := RecRef.GETPOSITION; RecRef.CLOSE; IF TextLine <> '' THEN BEGIN RecRef2.OPEN(Object.ID, FALSE, Object."Company Name"); RecRef2.SETPOSITION(TextLine); RecRef2.CLOSE; END; UNTIL Object.NEXT = 0; Window.CLOSE;
Matteo
mmm One question...
Try "GETPOSITION(FALSE);" instead of "GETPOSITION;"
I think you have a custom table with 2 field with different names but same caption.
can it be?
MatteoReno Sistemi Navision Developer0 -
wow nice :
I created a new custom table with 2 fields with different names but same italian caption (no ENU caption).
If i set my language to Italian:
GETPOSITION(TRUE) RTC client will crash.
GETPOSITION(FALSE) works.
If i set English it works both true or false parameter.
very nice!
MatteoReno Sistemi Navision Developer0 -
matteo montanari wrote:wow nice :
I created a new custom table with 2 fields with different names but same italian caption (no ENU caption).
If i set my language to Italian:
GETPOSITION(TRUE) RTC client will crash.
GETPOSITION(FALSE) works.
If i set English it works both true or false parameter.
very nice!
Matteo
You cracked it! Nice one Matteo!
GETPOSITION(FALSE) sorted the issue =D>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