web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

SETCURRENTKEY bug?

(0) ShareShare
ReportReport
Posted on by 750

In NAV 2015 I by accident used SETCURRENTKEY with a key that not existed. When I ran the codeunit no errors occured.

When I look at the documentation it says

"If no keys can be found that include the fields that you specify, the return value is FALSE. If you do not test the return value, a run-time error occurs. If you do test the return value, the program will continue to run even though no key was found."


If I create a simple table with id and name the code below will return True (in 2013 R2 and 2015) no matter what field I select as key. In 2009 it behaves as the documentation.

keyworking := r.SETCURRENTKEY(name2);
MESSAGE(FORMAT(keyworking));

Is this a bug or is the documentation not up to date?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Rajasekhar@MS Profile Picture
    5,569 on at

    Hi

    From Nav 2013 R2 with the Introduction of Interactive soring feature, it is no longer required to define a Key on a table to sort data. SetCurrentKey no longer requires a Key to be created in the table.

    refer the below for details

    https://markbrummel.wordpress.com/2013/10/23/nav-2013-r2-keys-keygroups-and-setcurrentkey/

    https://markbrummel.wordpress.com/2013/09/10/nav2013r2-interactive-sorting/

     Its not a bug, seems to be the document not updated

    Best Regards

    Rajasekhar.Y

  • Suggested answer
    Tharanga Chandrasekara Profile Picture
    23,118 on at

    With the introduction of Dynamics NAV 2013 R2 version interactive soring feature was introduced to Dynamics NAV. Therefore you no longer required to define a key in the table level to sort it in the run time. You can sort the data with any field.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans