Rename

pvar
Member Posts: 157
Is there a way to bypass the OnRename trigger of the table while renaming the primary key of a table from a report?
I know for INSERT (also for MODIFY & DELETE) you could specifiy INSERT(FALSE) to bypass the table trigger but I couldn't find anything like that for RENAME.
Thanks for any help.
I know for INSERT (also for MODIFY & DELETE) you could specifiy INSERT(FALSE) to bypass the table trigger but I couldn't find anything like that for RENAME.
Thanks for any help.
0
Comments
-
-
You can put the code in the rename-trigger in a function and call it from the rename-trigger.
Function OnRenameTrigger IF NOT blnSkipRenameCode THEN BEGIN .. the standard rename code END;
Create also the function:Function SkipRenameCode(IblnSkipRenameCode as Boolean) blnSkipRenameCode := IblnSkipRenameCode;
Now, just before you run the RENAME, do this:recSomeRecord.SkipRenameCode(TRUE); recSomeRecord.RENAME(new primary key-values);
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thanks for the suggestion. I knew I could do something like that but I was trying to see if I could rename without having to change the table trigger.0
-
I am using a boolean to bypass the code as described here, and that works fine in the native verson of a 3.70 database.
However when running on SQL server the system runs the rename trigger a second time - and that time it is out of the context so the boolean bypass do not work.
Is this correct, and is there a way to overrule this?0 -
What about going in this way:
- creating temp variable and copying data into it
- change (rename) fields you want to rename
- delete old item with delete(false)
- insert new item from temp variable with insert(false)
In this way, you will change (rename) the fields you want, and will not triger any of OnRename, OnInsert, OnDelete trigers.Tomas,
Dynamics NAV Enthusiast0 -
Tomas wrote:What about going in this way:
- creating temp variable and copying data into it
- change (rename) fields you want to rename
- delete old item with delete(false)
- insert new item from temp variable with insert(false)
In this way, you will change (rename) the fields you want, and will not triger any of OnRename, OnInsert, OnDelete trigers.
Yes, but it means that related fields will not be renamed too...0 -
I would advice to just use the rename like it was meant to be.
If you want to speed up the proces of renaming, I think the fastest way is to clean up the database. Take a look at the connected tables and see in which tables you could delete some records..
Tino Ruijs
Microsoft Dynamics NAV specialist0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions