Thursday, November 26, 2009

How to read BLOB data and export into a File

In Microsoft Dynamics NAV tables, we can create BLOB fields to store large amount of data. It is not possible to read the data in the BLOB fields directly.

The following steps shows the procedure to read the BLOB data. In this example, I have taken “User Metadata” table to read the data in the “Page Metadate Delta” field.

1) Create a codeunit with the below variables.

Name DataType Subtype Length
UserMetadata Record User Metadata  
Data InStream    
Line Text   1024
Pos Integer    
File1 File    

2) Add the following code to the codeunit.

image 3) Save and Run the codeunit. Text file will be created in the given path with the data in the BLOB field.

Thanks,

Veerendra CH.

3 comments:

  1. How do I import the Test.txt?

    Thank you.

    ReplyDelete
  2. Hi Veerendra
    This code is perfect - thank you for posting this!!
    Chris

    ReplyDelete