SETTABLE/GETTABLE - different behaviour in 2009 and 2016?

toLLtotoLLto Member Posts: 34
Hi,

we are upgrading a NAV 2009 R2 Database to 2016. There are some 3rd party objects, and some of them don't work the same way in new NAV. In 2009 I've such code:

_Rec.SETRANGE(Code, _Code);
_RecordRef.OPEN(_TableNo);
_RecordRef.SETTABLE(_Rec);
IF NOT _RecordRef.FIRST THEN EXIT(0);
_FieldRef := _RecordRef.FIELD(_FieldNo);

in 2009 both _RecordRef and _Rec have the same filters applied after this code executes. In 2016 not anymore and the _RecordRef is taking the first record from the table.

In MSDN I read that SETTABLE actually should set the table of the Record Variable as the same as RecordRef variable. This would mean that above code is completely wrong, it should use the GETTABLE function. But why it worked in 2009? Or is this somekind of a bug in 2016?

I found over 300 usages of this function in this small add-on, and now we need to decide if we need to correct all this lines and be sure that it will not brake after future 2016 CU.

Best Answer

Answers

Sign In or Register to comment.