CALCFIELDS and BLOB in newer NAV versions

Just wanted to put this out there.

In older NAV versions you needed CALCFIELDS on a BLOB field before HASVALUE.  Now you can ask for HASVALUE before CALCFIELDS.

Having unsaved data in a BLOB field and doing CALCFIELDS will try to get the saved data into the BLOB field.  Try a code like this:

[code]
TempBlob.INIT;
IF FileMgt.BLOBImport(TempBlob,’Image.png’) = ” THEN EXIT;
Storage.Blob := TempBlob.Blob;
MESSAGE(‘Blob has value: %1’,Storage.HASVALUE);
Storage.CALCFIELDS(Blob);
MESSAGE(‘Blob has value: %1’,Storage.HASVALUE);
[/code]

This CALCFIELDS will remove the data from the BLOB field.

Doing an INSERT or MODIFY before CALCFIELDS will fix the error, or simply remove the CALCFIELDS line.

One Reply to “CALCFIELDS and BLOB in newer NAV versions”

Leave a Reply

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