If you are working with temp table, in generally you are not using VALIDATE or INSERT(True) etc. (Why? Because if yes and you will modify another data within the triggers, you can have BIG problem...).
No but good Naming Conventions will help, look at the Standard Code, in the posting units you will see, TempDocDim, TempSalesLine etc:, these have thier property set to temporary.
If you make a mistake, and do a un-condition delete, on a live table #-o
So always test in a development server, never on the live, and check all, data (view all if you have filters), not just the couple of records you inserted. :whistle:
function IsTemporary() : Boolean;
BEGIN
RecRef.GETTABLE(Rec);
EXIT(RecRef.NUMBER>=1000000000);
END;
it seems that temporary tables numbers are >=1000000000
But i must thank kine for a very important tip that actually solved my problem
"If you are working with temp table, in generally you are not using VALIDATE or INSERT(True) etc."
All i had to change was MyTempRec.INSERT(TRUE) with MyTempRec.INSERT(FALSE);
It's not always that simple Eugene . You should at least check what happens in the OnInsert trigger, so you can duplicate the logic if that is needed, or write your own logic. Like for instance numbering series. For sure you don't want to mess up numbering series while in a temp record, so you'll hae to write your own logic to create a new number. There may be descriptions from other tables that are populated in the Insert trigger. Just changing the parameter from TRUE to FALSE is not always the complete solution.
function IsTemporary() : Boolean;
BEGIN
RecRef.GETTABLE(Rec);
EXIT(RecRef.NUMBER>=1000000000);
END;
it seems that temporary tables numbers are >=1000000000
Functionality has changed beginning with NAV 2009. You should no longer rely on a temporary Table number anymore. In fact, it does not work anymore. But Microsoft has added a property ISTEMPORARY.
With Versions 2009 up to 2015, you still have to convert your Record to a RecordRef. Unfortunately this useful property is available for a Record variable only starting from NAV 2016.
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
If you make a mistake, and do a un-condition delete, on a live table #-o
So always test in a development server, never on the live, and check all, data (view all if you have filters), not just the couple of records you inserted. :whistle:
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
function IsTemporary() : Boolean;
BEGIN
RecRef.GETTABLE(Rec);
EXIT(RecRef.NUMBER>=1000000000);
END;
it seems that temporary tables numbers are >=1000000000
But i must thank kine for a very important tip that actually solved my problem All i had to change was MyTempRec.INSERT(TRUE) with MyTempRec.INSERT(FALSE);
RIS Plus, LLC
With Versions 2009 up to 2015, you still have to convert your Record to a RecordRef. Unfortunately this useful property is available for a Record variable only starting from NAV 2016.
Franz Kalchmair, MVP
Alias: Jonathan Archer
please like / agree / verify my answer, if it was helpful for you. thx.
Blog: http://moxie4nav.wordpress.com/