Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 08 MAY 2011 10:07:44AM Karl Pozmann wrote:

I'm attempting to store word documents within LH using the binary data type. The code to store the data looks basically like this:

Filename=C:\DEV\WORD\TEST.DOC"

OsRead Binary from Filename Else…

Record=Iconv(Binary,'VB')

Write Record on LH_Binary,"TEST" else null

Then I retrieve the binary data and write it out to a file:

Filename=c:\dev\workspace\test.doc"

Read Record from LH_Binary,"TEST" Else Record='

Binary=Oconv(Record,'VB')

OsWrite Binary on Filename

At this point if I attempt to bring that document up in word I get a message saying the file is corrupt.

Has anyone else tried doing this with Word? This same approach appears to work with PDFs for what it's worth.


At 08 MAY 2011 12:17PM Stefano Cavaglieri wrote:

Karl,

storing binary data in a field is not reliable, because of the way OI handles its delimiters. If you use a full record, such as:

Record=Iconv(Binary,'VB')

that will work. If you absolutely need to store your binary data in a field, then put it into the last one and delete the lower fields just before the Oconv, like this:

Filename=C:\DEV\WORD\TEST.DOC"
OsRead Binary from Filename Else...
Record=Iconv(Binary,'VB')
Write Record on LH_Binary,"TEST" else null
Then retrieve the binary data and write it out to a file:
Filename=c:\dev\workspace\test.doc"
Read Record from LH_Binary,"TEST" Else Record='
for Z=1 to 4
  Record=delete(Record, 1, 0, 0)
next Z
Binary=Oconv(Record,'VB')
OsWrite Binary on Filename

Hope it helps,

Stefano


At 08 MAY 2011 12:41PM Karl Pozmann wrote:

Yes that works, thanks.


At 09 MAY 2011 04:54PM Jared Bratu wrote:

Regarding the first example, IConv(Binary, "VB") should return the value of Binary in a delimiter safe format so you can set/get it from a field. This should make the second (cleaver) example obsolete.

When the record is read you'll have to OCONV(FieldData, "VB") to get the original Binary value. This is according to the OpenInsight 9.2.1 help file.

Have you had problems with the IConv VB format in the current release?

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/ea44e734dc965ab48525788a004d9d21.txt
  • Last modified: 2023/12/30 11:57
  • by 127.0.0.1