Question Status

Suggested Answer
PIX asked a question on 11 Mar 2013 11:28 AM

Hello,

I need to save a PDF file to a field in a new ax custom table.

Which should be the right EDT of this field? Have you any example of the code?

Thx

Reply
Suggested Answer
Martin Dráb responded on 11 Mar 2013 2:39 PM

You can use Blobdata EDT, for example. Or same other type based on "container" primitive type.
The easiest way is to use BinData class - call loadFile() to get data from file and getData() to convert it to container.

Martin "Goshoom" Dráb | Freelancer | Goshoom.NET Dev Blog

Reply
PIX responded on 12 Mar 2013 4:13 AM

Martin,

I know that, but I would know if the blob field could be filled in this way:

       if (binData.loadFile(serverFilename))

       {

               blob = binData.getData();

           return blob;

       }

where blob is blobdata and I can be sure that the field contents could be readable

How could I show this field  in a form? This is the reason why I need some code as example

At the moment I don't know if the content is readable or not

Thx

Reply
Martin Dráb responded on 12 Mar 2013 6:26 AM

Sorry Pix, but you really asked about saving and EDT, which is what I answered.

The blob contains binary data representing the PDF file, so you'll need something what understands this binary format, i.e. a PDF viewer. Adobe Reader comes with an ActiveX control (see c:\Program Files (x86)\Common Files\Adobe\Acrobat\ActiveX\) and I've seen it used in Dynamics AX, so I would recommend you to go in this direction.

Martin "Goshoom" Dráb | Freelancer | Goshoom.NET Dev Blog

Reply
Jonathan Havard responded on 15 Mar 2013 9:29 AM

Pix,

Perhaps if you provided more detail with regards to the business problem you're trying to address we could provide potential solutions that are closer to what you're looking for.

If you're looking to store a PDF file, you can do so in a container with the methods already mentioned.  It sounds like you're ok with this.  When you say "show this field in a form", what do you expect to be represented on the screen?  Typically you don't see container type fields mapped directly to controls on a form, so I have difficulty imagining what it is you're trying to do.

Jonathan P. Havard
Developer, Sikich Technology
Sikich LLP

Reply
Suggested Answer
Martin Dráb responded on 11 Mar 2013 2:39 PM

You can use Blobdata EDT, for example. Or same other type based on "container" primitive type.
The easiest way is to use BinData class - call loadFile() to get data from file and getData() to convert it to container.

Martin "Goshoom" Dráb | Freelancer | Goshoom.NET Dev Blog

Reply