Xbasic

PROPERTIES_ENUM Function

Syntax

Property_List as C = PROPERTIES_ENUM(P variables[,C variable_enum_flags[,C typemap]])

Arguments

variables

The name of a dot variable.

variable_enum_flags

Optional. "R" = Recursive, retrieves sub-methods and properties, "O" = Allows formatting options, "<type>" = Exclude <type> from output, where is one of C (character), N (numeric), D (date), F (function), or A (array)

O Flags
Meaning
"p"

Variable name, functions as prototype

"v"

The value of the variable (up to 80 characters of a character variable).

"t"

Type

"n"

Name

"u"

Uppercase name

"l"

Lowercase name

"f"

Proper case name (upper case first letter, rest lower case)

"d"

Description (for functions)

"x"

Limitations (for functions)

"b"

Only show variables whose data is not blank

"e"

Expand to <variable>=<expression> pair (Obsolete. Use property_to_script() instead.)

typemap

For internal Alpha use

Description

Returns CR-LF serarated property list.

Discussion

PROPERTIES_ENUM() returns a CR-LF delimited string of properties of a "dot" variable. "R" is recursive, so if you have:

foo.x = 1
foo.y = 2
foo.pt.x = 3
foo.pt.y = 4
? properties_enum(foo, "R")
x
y
pt.x
pt.y

"O" allows formatting options, so,

properties_enum(foo, "R;O=p|v|t")
= X|1|Number
Y|2|Number
Pt||Property.X|3|Number
Pt||Property.Y|4|Number

Example 

The following Interactive Window session demonstrates defining a "dot" variable with multiple properties and sub-properties.

dim family as P
family.mom.name = "Irene"
family.mom.age = 34
family.dad.name = "Joe"
family.dad.age = 44
family.name = "Smith"
? Properties_enum(family)
= "mom
dad
name
"
? Properties_enum(family, "r")
= "mom.NAME
mom.age
dad.NAME
dad.age
name
"

The following Interactive Window session demonstrates using the "!" flag to get all the properties (fields) from a table object, excluding all the functions and methods.

t = table.open("customer")
? properties_enum(t,"!F")
= DELETED
CUSTOMER_ID
FIRSTNAME
LASTNAME
COMPANY
PHONE
FAX
BILL_ADDRESS_1
BILL_ADDRESS_2
BILL_CITY
BILL_STATE_REGION
BILL_POSTAL_CODE
BILL_COUNTRY
SHIP_ADDRESS_1
SHIP_ADDRESS_2
SHIP_CITY
SHIP_STATE_REGION
SHIP_POSTAL_CODE
SHIP_COUNTRY
SHIP_SAME
EMAIL
CREDITRATING

See Also