This is really annoying me.
I'm new to Navision, and, as you can probably tell, am still learning the basics.
I want to transfer data from one table to another. When I get this basic part working, I will refine the data.
I am trying to do this with:
GrecDeletedSalesInv.GET;
GrecDeletedSalesInv.TRANSFERFIELDS(SalesInvHeader, FALSE);
GrecDeletedSalesInv.INSERT;
The tables are exact copies of each other (I used save as and just changed the ID/Name)
However whatever I try it doesn't work as desired.
In this case it returns the error:
The Sales Invoice Header already exists.
Identification fields and values:
No.=''
I've made sure there are no records in the table being written to
Comments
Did you read the help on TRANSFERFIELDS: http://msdn.microsoft.com/en-us/library/dd301438(v=nav.70).aspx?
Never stop learning
Van Vugt's dynamiXs
Dutch Dynamics Community
Your problem is that if you can GET the DeletedSalesInv then it has already been INSERT-ed by some other code. Or by application behavior like user on a form.
So either remove that other code that did it, or if you consider that correct behavior and in this code you need to modify an existing DeletedSalesInv, use DeletedSalesInv.MODIFY instead of INSERT.
Never stop learning
Van Vugt's dynamiXs
Dutch Dynamics Community
What I think I was misunderstanding (other than the GET) was that I needed to loop it for it to do it with every line in the range.
I ended up using