In the earlier version of Navision it was not possible to enable keys on the fly. All you could do was either having fixed keys, using key groups or doing a “hack” with performing a SQL request.
Fixed keys are ok – but in large tables, it is not always a good idea to a lot of keys. Therefore often you will see that they have a minimized set of keys. A lot will properly be deactivated.
Activating keys with a SQL request is not the perfect solution; it really demands that you know what you are doing.
For this reason key group was introduced. With key groups, it was possible for the user to manually activate a key before a run. So for reports, codeunits, etc. which is seldom executed, you would activate the needed key group before execution start. This was though not always an optimal solution, because the key group could not be activated from code (C/AL), and therefore the user often did forget to enable it before the big runs.
This has now changed with Dynamics Navision 5 🙂
With Navision 5 three new commands was introduced:
KEYGROUPENABLE can be used for enabling a key group through code, and thereby you can enable a needed key.
KEYGROUPDISABLE can be used for disabling a key group.
With KEYGROUPENABLED you can check if a key group already is enabled.
So where do we find key groups? Key groups are defined in the table view (File -> Database -> Information -> Tables, Button Key Groups). Here you can add a new group, delete groups and enable/disable them.
To add a specific key to a key group, go into the table design and view the keys. Here you can add the Key Group. If you can not see the field, then it is simple a hidden column.
Leave a Reply