Xbasic

PROPERTY_FROM_BLOB Function

Syntax

PROPERTY_FROM_BLOB( Dot_Variable as P, Property_Data as B [, Format_String as C ] )

Arguments

Dot_Variable

The name of a dot variable.

Property_String

A blob that was originally created using the PROPERTY_TO_BLOB()function.

Format_String

Optional. Specifications for formatting the data. Refer to the <ARRAY>.INITIALIZE_PROPERTIES()method.

Description

Property read from blob data that was orginally created with PROPERTY_TO_BLOB()

Discussion

The PROPERTY_FROM_BLOB() function initializes the values in a "dot" variable referenced by Dot_Variable. Property_Data is a blob that was originally created using the PROPERTY_TO_BLOB()function, and it contains the value of each sub-element of the dot variable. (If the optional Format_String is specified, then Property_String has a different format. See below.) . .

Example

Before you initialize variables using PROPERTY_FROM_STRING() , at least one of the dot variables sub-elements must be initialized. For example, assume that you want to initialize a dot variable called "p2". Before the PROPERTY_FROM_STRING() function is used you must execute this Xbasic:

'Declare the dot variable
dim P2 as P
'Initialize a dot variable sub-element.
P2.dummy = ""

Having done this, you can now call the PROPERTY_FROM_BLOB() function. For example (Assume that data was previously created using the PROPERTY_TO_BLOB() function):

dim p as P
p.dummy = ""
property_from_string(p, data)

Specifying a Format String

If the optional Format_String parameter is specified, then string must be in the format specified in the Format_String. The syntax of the Format_String is the same as is used in the <ARRAY>.INITIALIZE_PROPERTIES()method. For example:

data = "Fred|Smith|46"
format = "first_name:c|last_name:c|age:N"
dim p as P
p.dummy = ""
property_from_blob(p, data, format)
? p -> age = 46.000000
dummy = ""
first_name = "Fred"
last_name = "Smith"

See Also