This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20 R7
DOCUMENT TO BLOB
|
DOCUMENT TO BLOB ( document ; blob ) | ||||||||
Parameter | Type | Description | ||||||
document | String |
![]() |
Name of the document | |||||
blob | BLOB |
![]() |
BLOB field or variable to receive the document | |||||
![]() |
Document contents | |||||||
DOCUMENT TO BLOB loads the whole contents of document into blob. You must pass the name of an existing document that is not already open, otherwise an error will be generated. To let the user choose the document to be loaded into the BLOB, use the command Open document and the process variable document (see Example).
You write an Information System that enables you to quickly store and retrieve documents. In a data entry form, you create a button that allows you to load a document into a BLOB field. The method for this button could be:
$vhDocRef:=Open document("") ` Select the document of your choice
If(OK=1) ` If a document has been chosen
CLOSE DOCUMENT($vhDocRef) ` We don't need to keep it open
DOCUMENT TO BLOB(Document;[YourTable]YourBLOBField) ` Load the document
If(OK=0)
` Handle error
End if
End if
OK is set to 1 if the document is correctly loaded, otherwise OK is set to 0 and an error is generated.
In each case, you can trap the error using an ON ERR CALL interruption method.
Product: 4D
Theme: BLOB
Number:
525
Created: 4D v6
Storing documents, Resource fork, Data fork, Document
4D Language Reference ( 4D v20 R7)