Error when converting Write Classic to Write Pro

To migrate from Write Classic to Write Pro I am converting Write Classic documents stored in Blob fields to Object fields in the same table. To make the conversion I am passing the Write Classic blob field to WP New.

Occasionally I get this error:

Error when executing the method “_ConvertWRBlobToWPObject” at line number 44

4D Write Pro legacy import has failed to complete.

Error code: 103 (wri1)
4D Write Pro legacy import has failed to complete.
component: ‘wri1’
task -11, name: ‘P_3’

The code at line number 44 is: $ObjectFieldPtr->:=WP New($BlobFieldPtr->)

My assumption is that the blob field holds a document from an old version of Write Classic, but when I use WR BLOB TO AREA to load it into a WR New offscreen area the resulting area is size 0.

How can I get more details on what might be causing this error? Or maybe the blob holds something other than a WR document? How can I determine that?

BTW, most (thousands) of the blobs convert successfully. Only 10 or 20 fail.

Thanks,

Tom Benedict

Hello Tom

First of all, using pointers on objects is useless. Use objects directly, they are already references (i.e. do not hesitate to send an object as parameter to a method, even a huge 4DWP document !)

So rather than writing
$ObjectFieldPtr->:=WP New($BlobFieldPtr->)

you should write
$ObjectField:=WP New($BlobFieldPtr->)

(and, YES, keep a pointer on the Blob. A Blob is a Blob, not a reference :slight_smile:


About your conversion issue now. If your document is really old, you should try to open it and re-save it again using 4D Write. So it will be saved with a newer version of 4D Write and this may help.

Regards

Roland

Thanks for the timely reply Roland!

First of all, using pointers on objects is useless. Use objects directly, they are already references (i.e. do not hesitate to send an object as parameter to a method, even a huge 4DWP document !)

I don’t typically use a pointer on an object, but in this case I wanted to determine the table and field name which holds the WP document, so I passed the pointer. Maybe I should add dedicated parameters for table and field?

If your document is really old, you should try to open it and re-save it again using 4D Write. So it will be saved with a newer version of 4D Write and this may help.

I considered that the document might be ancient, but converting using Write Classic didn’t seem to improve the situation. I also thought that the blob might be compressed, but that didn’t help either. It’s possible that the documents were corrupted in the course of development. I need to do further work to validate my conversion scripts.

Thanks again,

Tom Benedict

Hi Tom

: Tom BENEDICT

I don’t typically use a pointer on an object, but in this case I
wanted to determine the table and field name which holds the WP
document, so I passed the pointer. Maybe I should add dedicated
parameters for table and field?

This was a general consideration. If for some reasons you need pointers that’s fine. The important thing is to understand that objects are passed as references, not as values.
Ex: myObject2:=myObject1 just duplicates a reference to a single object :slight_smile:

: Tom BENEDICT

It’s possible that the documents were corrupted in the course of
development. I need to do further work to validate my conversion
scripts.

If blob is corrupted (but i can’t say why) there is no miracle…

Regards

Roland