Migrate 4D Write documents stored in picture fields

4D Write Pro has become a mature product with a lot of functionalities, surpassing the 4D Write plug-in in many areas (tables and bookmarks, for example). Furthermore, 4D Write Pro is 64-bits compliant, which is great since most operating systems will soon be 64-bits only. Migrating your documents from 4D Write to 4D Write Pro is a “must do”. In order to help you and your customers’ migrations, we’ve simplified the migration process with a ready-to-use component!

4D Write documents can be read and transformed into 4D Write Pro documents quite easily using the WP New command. Note that in order for 4D Write documents to be converted with this command, the documents must have be saved in BLOB fields and not in PICTURE fields.

Using picture fields to store 4D Write documents used to be the way to go, but beginning with 4D Version 6 (1996 … 22 years ago!) the recommendation has been to use BLOB fields. Incredibly, some older applications are still using picture fields – and this blog post aims to help them with the migration process.

a component to the rescue!

The goal is to read a 4D Write document saved inside a picture field and then save it in an object field … in one fell swoop. 

For this, we’ve created a 4D component with a single method that receives a picture field as parameter and returns a Blob. The returned BLOB will be compatible with the WP New command, and a brand new 4D Write Pro document will be created!

Guess what?? This will work directly in 64 bits, so there’s no need to use the old 4D Write plug-in! Once all of your documents are saved into object fields, the component can be removed from your database.

$Blob:=Extract4W7 ([WR_DOCS]wrPictureDocument)
[WR_DOCS]wpDocument:=WP New($Blob)

Just two lines of code to get the job done!

The 4D component, as well as its source code, is available for download at no charge. 

From 4D Write to 4D Write Pro component


Roland Lannuzel
• Product Owner & 4D Expert •After studying electronics, Roland went into industrial IT as a developer and consultant, building solutions for customers with a variety of databases and technologies. In the late 80’s he fell in love with 4D and has used it in writing business applications that include accounting, billing and email systems.Eventually joining the company in 1997, Roland’s valuable contributions include designing specifications, testing tools, demos as well as training and speaking to the 4D community at many conferences. He continues to actively shape the future of 4D by defining new features and database development tools.