Table locate in script crashes

In the script I try to select a specific table record by using the locate function.

      lgnr := 1;    // DEBUG ++++++++++++++++++++++++++++++++++++++++++++++++++
      if not DM1.tblKKDLScript.Locate('LagerNr', lgnr, []) then begin

The first errormessage is Variant of type (Array Variant) could not be converted to typ (integer).
More such messages follow.
I tried to upload a screenshot, but the insert Image function above seems to be unable to upload an image from my local harddisk.
The table is used exclusively by the script, I am quite sure that there is no access conflict.

You should use SetOf to convert arrays to sets in scripter:


if not DM1.tblKKDLScript.Locate('LagerNr', lgnr, SetOf([])) then begin