Hi all,
I want to use TRANSFERFIELD.
SalesOrderEX.SETFILTER(SalesOrderEX."Sales Order No", SalesHeader."No.");
IF SalesOrderEX.FIND('-') THEN
BEGIN
SalesInvoiceEX.INIT;
SalesInvoiceEX.TRANSFERFIELDS(SalesOrderEX);
SalesInvoiceEX.INSERT;
END;
Is the above code correct?
thanks.
0
Comments
Use this function to copy all matching fields in one record to another record.
It just copies over all matching fields (field number / data type). So the code should work, if both your tabledefinitions are alike.
comments:
- You code is also going to copy over the primary key fields.
- If your record contains a blob field, you should calculate the Blob field before the transferfields... .
It should work (if all reqs are fullfilled) ... what is wrong with it?
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
But I suppose you want to automatically generate a new primary key. In this case this will be the code (I also cleaned up your code a little):
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
From help:
IfI understand correctly, the default value is true, and if it is true, it will change the primary key fields of the destination record (for me, that copying over...).
Anyway, I did one simple test: And the second message shows '10000'... .
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
Luckily in my programming, I always put code for changing fields (including the primary key) I want to change AFTER the TRANSFERFIELDS. \:D/
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I do this myself as well ... .
Makes things much clearer.
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
RIS Plus, LLC
a few years ago, I started the concept "lazy programming" at our company. Pretty interesting tips&tricks already
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
Or a topic in tips&tricks?
Maybe others can add tips to it.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
When I'm on a plane or something, I will write it out... .
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
RIS Plus, LLC
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I have added a download some time ago ... the table generator .. that is one of the tools that made our live easier.
I have a feeling we're going a bit off topic here ... :oops:
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog