Quantcast
Channel: Massive Dynamics NAV
Viewing all articles
Browse latest Browse all 4

Deleting data in many tables - quick and easy

$
0
0

When you are going live with a NAV database environment at your customer’s you may be in a situation where it is necessary to delete some data your customer has played around the preceeding months (may be ledger entries, sales line, …) but you don’t want to delete some other data which you or your customer has already prepared for the live scenario (master data,…). In this situations where it is necessary to delete all data in certain and may be many tables, it would be nice to have a tool. This tool should be as easy as possible. It should not be necessary to use additional tables or complicated setup to delete the desired table data. In fact NAV already provides a tool to setup table data - the user rights management. The idea is as follows: Setup a user role, let’s call it _DELETE_DATA and supply this user role with appropriate delete permissions for the table data you want to delete. Then run a simple report (using a RecordRef) to delete the data.

So let’s start with this. When you setup the user role you have got two possibilities. You can either add each table data to delete manually (this would be the way to go, if the number of tables is not to great) or you can start with all table datas to delete and remove the delete permission from those tables you don’t want to delete data. To do it the second way you first will have to comprise a line like this:
pic10.jpg
Then after clicking at “All Objects”, you can remove the delete permission from those tables, you don’t want to delete data.
Now here is the simple report you will have to run finally in order to delete the data.�
report98001.txt
The report will work very quickly (because of the DELETEALL and no performing of DELETE-triggers), but you might need SUPER-user rights in order to delete some data (the permissions of the role _DELETE_DATA are not checked by the NAV permission management system, since the user role is not assigned to any login). Nevertheless be careful when deleting data. Note that you are using the code on this site at your own risk. No liabilty can be taken from the author.


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images