Blob Data and TRANSFERFIELDS

As I was reading the list of published platform updates for NAV 2013 I saw that Microsoft was fixing a bug where the content of a BLOB field is not transferred to a new record with the TRANSFERFIELDS function.  I must admit that I have never counted on the TRANSFERFIELDS function to move the BLOB data from one table to another.  I have always created in- and outstream like this

[code]
InboxTransaction2.CALCFIELDS("PDF Document");
IF "InboxTransaction2.PDF Document".HASVALUE THEN BEGIN
InboxTransaction2."PDF Document".CREATEINSTREAM(InStr);
HandledInboxTransaction2."PDF Document".CREATEOUTSTREAM(OutStr);
COPYSTREAM(OutStr,InStr);
END;[/code]

Now, If I am using a version of NAV 2013 that has fixed the TRANSFERFIELDS bug I can simply do

[code]
InboxTransaction2.CALCFIELDS("PDF Document");
HandledInboxTransaction2."PDF Document" := InboxTransaction2."PDF Document";[/code]

or

[code]
InboxTransaction2.CALCFIELDS("PDF Document");
HandledInboxTransaction2.TRANSFERFIELDS(InboxTransaction2);[/code]

Keep in mind that if the CALCFIELDS function is missing then nothing will be transferred.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.