4D v14.3

BLOB to list

Home

 
4D v14.3
BLOB to list

BLOB to list 


 

BLOB to list ( blob {; offset} ) -> Function result 
Parameter Type   Description
blob  BLOB in BLOB containing a hierarchical list
offset  Longint in Offset within the BLOB (expressed in bytes)
in New offset after reading
Function result  ListRef in Reference to newly created list

The BLOB to list command creates a new hierarchical list with the data stored within the BLOB blob at the byte offset (starting at zero) specified by offset and returns a List Reference number for that new list.

The BLOB data must be consistent with the command. Typically, you will use BLOBs that you previously filled out using the command LIST TO BLOB.

If you do not specify the optional offset parameter, the list data is read starting from the beginning of the BLOB. If you deal with a BLOB in which several variables or lists have been stored, you must pass the offset parameter and, in addition, you must pass a numeric variable. Before the call, set this numeric variable to the appropriate offset. After the call, that same numeric variable returns the offset of the next variable stored within the BLOB.

After the call, if the hierarchical list has been successfully created, the OK variable is set to 1. If the operation could not be performed, the OK variable is set to 0; for example, if there was not enough memory.

Note regarding Platform Independence: BLOB to list and LIST TO BLOB use a 4D internal format for handling lists stored in BLOBs. As a benefit, you do not need to worry about byte swapping between platforms when using these two commands. In other words, a BLOB created on Windows using those two commands can be reused on Macintosh and vice-versa.

Example  

In this example, the form method for a data entry form extracts a list from a BLOB field before the form appears on the screen, and stores it back to the BLOB field if the data entry is validated:

  ` [Things To Do];"Input" Form Method
 
 Case of
 
    :(Form event=On Load)
       hList:=BLOB to list([Things To Do]Other Crazy Ideas)
       If(OK=0)
          hList:=New list
       End if
 
    :(Form event=On Unload)
       CLEAR LIST(hList;*)
 
    :(bValidate=1)
       LIST TO BLOB(hList;[Things To Do]Other Crazy Ideas)
 
 End case

The OK variable is set to 1 if the list has been successfully created, otherwise it is set to 0.

 
PROPERTIES 

Product: 4D
Theme: BLOB
Number: 557

The OK variable is changed by the command

 
HISTORY 

Created: 4D v6

 
SEE ALSO 

LIST TO BLOB

 
TAGS 

List, Hierarchical List

 
ARTICLE USAGE

4D Language Reference ( 4D v11 SQL Release 6)
4D Language Reference ( 4D v12.4)
4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v14 R3)
4D Language Reference ( 4D v13.5)
4D Language Reference ( 4D v14.3)
4D Language Reference ( 4D v14 R4)