is there a way to activate/deactivate table keys without opening each of them in design mode, go to view keys, Check/uncheck the activate field and compile?
I thought I would add a little more information than just a one word “answer”.
Key Groups are a higher level of grouping Keys into associated areas with an easy interface to enable or disable them.
As standard Navision Cronus will come with the following keys set-up:
To see these, go File → Database → Information. Click “Tables” then Click “Key Groups”
From here you can “Enable” - Turn on, Or “Disable” - Turn Off.
This will find all keys that have been set-up to this key group and turn them On or Off depending on the button you pressed.
To see what key group a key is in. Design the table in question. View the keys, select the key you want to check and look at the Key Properties (Shft+F4). There is a field called “KeyGroups”, here you can see and edit the Key Group this key is in.
It is a static text field. i.e. no lookup, AssistEdit etc…
You can see this key from the Sales Line table is part of “Item(Dim)” and is currently disabled.
Adding Your Own Key Group
You can add your own Key Group easily.
In this example we will add a key Group called “TonysMods”
I find all the keys that I want in my groug, viewing the Key Properties I type “TonysMods” in the KeyGroups field for each of the keys I want to use.
Once I have saved the changes to all the keys I’ve just added I open “Table Information”
From here I open “Key Groups” and create a new line.
I enter “TonysMods” in the newly created line under the column “Key Group”
I come off the line to make sure it is inserted properly.
Next I click the “Disabled” button followed by the “Enabled” button. I did this as I wanted to make sure that all the keys get into the same state i.e. disabled first, then enabled.
From now on I can turn on or off these key as needed.
This is great if you need a key for a long process such as a “Physical Inventory Journal” but don’t want to keep the key Enabled when not doing a stock check.
The end user’s IT Department or System Administrator can go and turn Off/On the key without a Developer/BA getting involved.
I hope that helped.
Since NAV 4.00 there is the virtual table 2000000063 “Key”. Using this table, you could enable/disable any key by setting the property “Enabled” via C/AL code.
But take care: disabling is quite fast, but enabling would re-create the index, which could be rather time consuming, depending on the number of records within a table!
Thank you very much. Now I really know everything about keys and keygroups! [:D]