4D v16.3

BLOB TO DOCUMENT

Home

 
4D v16.3
BLOB TO DOCUMENT

BLOB TO DOCUMENT 


 

BLOB TO DOCUMENT ( document ; blob {; *} ) 
Parameter Type   Description
document  String in Name of the document
blob  BLOB in New contents for the document
Operator in *** Obsolete, do not use ***

BLOB TO DOCUMENT rewrites the whole contents of document using the data stored in blob. You can pass the name of a document in document. If the document does not exist, the command creates it. If you pass the name of an existing document, make sure that it is not already open, otherwise an error is generated. If you want to let the user choose the document, use the commands Open document or Create document and use the process variable document (see example).

Compatibility Note: The optional * (resource fork management in older versions of Mac OS) is no longer supported in 4D as of 4D v16. For more information, see the Deprecated and Removed Features manual.

Example  

You write an Information System that enables you to quickly store and retrieve documents. In a data entry form, you create a button which allows you to save a document that will contain the data previously loaded into a BLOB field. The method for this button could be:

 $vhDocRef:=Create document("") ` Save the document of your choice
 If(OK=1) ` If a document has been created
    CLOSE DOCUMENT($vhDocRef` We don't need to keep it open
    BLOB TO DOCUMENT(Document;[YourTable]YourBLOBField` Write the document contents
    If(OK=0)
  ` Handle error
    End if
 End if

OK is set to 1 if the document is correctly written, otherwise OK is set to 0 and an error is generated.

  • If you try to rewrite a document that does not exist or that is already open by another process or application, the appropriate File Manager error is generated.
  • The disk space may be insufficient for writing the new contents of the document.
  • I/O errors can occur while writing the document.

In all cases, you can trap the error using an ON ERR CALL interruption method.



See also 

Create document
DOCUMENT TO BLOB
Open document

 
PROPERTIES 

Product: 4D
Theme: BLOB
Number: 526

The OK variable is changed by the commandThis command modifies the Error system variableThis command can be run in preemptive processes

 
HISTORY 

Created: 4D v6

 
TAGS 

Document, Resource fork, Data fork

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)