DataBasic Reference > Statements and Intrinsic Functions > E > EXTRACT Function

Comment on this topic

Documentation Comments

Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.

RealityV15.1Online Documentation (MoTW) Revision 7

EXTRACT Function (DataBasic) (m618703+extract_f.htm)

To

Reality

Version

Topic

Submitted by

Company

Location

Email address

Comment

 

 

EXTRACT Function

Returns an attribute, value or subvalue from a dynamic array.

Syntax

EXTRACT(dyn-array,attr#{,value#{,subval#}})

Note: This function has been replaced by dynamic array references, but is maintained here for compatibility.

Syntax Elements

dyn-array The name of a variable containing a dynamic array.

attr# An expression that evaluates to the number of the required attribute in the array.

If you specify a nonzero value for attr# and zero for both value# and subvalue#, the entire attribute is retrieved.

value# An expression that evaluates to the number of the required value within the attribute.

If you specify a nonzero value for both attr# and value# and zero for subvalue#, the specified value is retrieved.

subval# An expression that evaluates to the number of the required subvalue within the value.

If you specify nonzero values for attr#, value# and subval#, the specified subvalue is retrieved.

Comment

Attributes, values and subvalues are numbered starting at 1.

See information regarding invalid and illogical dynamic array references.

Examples

OPEN '',"TEST" ELSE STOP
READ X FROM 'NAME' ELSE STOP
PRINT EXTRACT(X,3,2,0)

Prints the second value in attribute three of item NAME in file TEST.

OPEN 'ACCOUNT' ELSE STOP
READ ITEM1 FROM 'ITEM1' ELSE STOP
IF EXTRACT(ITEM1,3,2,1)=25 THEN PRINT "MATCH"

Prints MATCH if the first subvalue in the second value in attribute three in ITEM1 equals 25.

RealityV15.1 (MoTW) Revision 7Comment on this topic