Hi Guys
I have tried a couple of variations of the temporary record to display results on a page and report. First below example
var
TempVend: Record Vendor temporary;
begin
TempVend.Init();
TempVend."No." := '30000';
TempVend.Insert();
TempVend."No." := '10000';
TempVend.Insert();
TempVend."No." := 'blah';
TempVend.Insert();
[b]TempVend.deleteall(true);[/b]
The problem is with table trigger = true , it deletes related records. I have seen recommendations to use above without true such as
deleteall() but the problem is by mistake someone else can modify this code to True or I can leave True and actually delete records on the source actual table.
So I prefer creating a brand new table of with:
TableType = Temporary;
Now I have to populate this table and display on a page at run time and if required I can union other tables. Same can be done on RDLC reports using an integer data item.
So I think the first pattern of setting an existing table to temporary is dangerous and I'm not sure why it still exists?
Answers
It is a good practice to test the variable to ensure it is temp. You can use ISTEMPORARY() to test the temp variables.
I have had the same issue where I accidentally deleted records because of this, and this is made worst, if there are several developers working on the same problem.
Jordi