How to use FINDSET function in Dynamics NAV?

FINDSET Function

So, do you know how to use FINDSET function? Of course you do… you always use it like IF FINDSET THEN REPEAT UNTIL… right? You have it in your blood. You have used it so many times… you can’t even remember when was the first time you have used FINDSET. This must be the easiest question, you can get on technical interview, right?

Well… let’s dig deeper. What parameters has function FINDSET? TRUE, FALSE? FALSE, FALSE? No… I meant, what parameters, as in what do they do?

… Western-movie-type silence …

Obviously, I have helped you here with a screenshot above… but once, when I got this question, I was not able to answer it. And I think that is the main reason why now, I could remember this, even if you would wake me up in the middle of the night – FINDSET(ForUpdate, UpdateKey)

ForUpdateType: Boolean
Set this parameter to true if you want to modify any records in the set; otherwise, set the parameter to false.
If you set this parameter to true, then the LOCKTABLE Function (Record) is immediately run on the table before the records are read.

UpdateKeyType: Boolean
Set this parameter to true if you want to modify any field value within the current key.
This parameter only applies if the ForUpdate parameter is true.

So, as they say, now  you know…

Next question: Why are you still not using parameters in this function?

Further reading:

This entry was posted in development, Dynamics NAV / Navision, Tips & Tricks and tagged , , , . Bookmark the permalink.

7 Responses to How to use FINDSET function in Dynamics NAV?

  1. Sergisoft says:

    Good article! FINDSET is used so much and not always programmers pay attention on parameters. The only problem of FINDSET is when you try to use it with temp tables…

  2. FINDSET is intended to be used with a confined set of records, on which there is more control through the “Record Set” database parameter available up until NAV 2009 R2.

Leave a Reply

Your email address will not be published. Required fields are marked *