Difference between revisions of "COPY TO ARRAY"

From Lianjapedia
Jump to: navigation, search
 
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Copy current table to an array
 
Copy current table to an array
 
  
 
==Syntax==
 
==Syntax==
 
COPY TO ARRAY <array>
 
COPY TO ARRAY <array>
 +
 +
[<scope>]
  
 
[FIELDS <field list>]
 
[FIELDS <field list>]
Line 11: Line 12:
  
 
[WHILE <condition>]
 
[WHILE <condition>]
 
  
 
==See Also==
 
==See Also==
[[AAVERAGE()]], [[ACHOICE()]], [[ACOPY()]], [[ADEL()]], [[ADIR()]], [[AFIELDS()]], [[AFILL()]], [[AINS()]], [[ALEN()]], [[AMAX()]], [[AMIN()]], [[APPEND FROM ARRAY]], [[ASCAN()]], [[ASORT()]], [[ASUM()]], [[AVERAGE]], [[DECLARE]], [[DIMENSION]], [[GATHER]], [[IN_ARRAY()]], [[IS_ARRAY()]], [[LOCAL]], [[PRIVATE]], [[PUBLIC]], [[RELEASE]], [[RESTORE]], [[SAVE]], [[SCATTER]]  
+
[[AAVERAGE()]], [[ACOPY()]], [[ADEL()]], [[ADIR()]], [[AFIELDS()]], [[AFILL()]], [[AINS()]], [[ALEN()]], [[AMAX()]], [[AMIN()]], [[APPEND FROM ARRAY]], [[ASCAN()]], [[ASORT()]], [[ASUM()]], [[AVERAGE]], [[DECLARE]], [[DIMENSION]], [[GATHER]], [[IN_ARRAY()]], [[IS_ARRAY()]], [[LOCAL]], [[PRIVATE]], [[PUBLIC]], [[RELEASE]], [[RESTORE]], [[SAVE]], [[SCATTER]]  
 
+
  
 
==Description==
 
==Description==
The COPY TO ARRAY command allows all or part of the active table to be copied to the previously declared two-dimensional specified array, <array>.  The target array must have elements defined that match the field list from the table.
+
The COPY TO ARRAY command allows all or part of the active table to be copied to the specified two-dimensional array, <array>.  The target array will be created or resized to accommodate the field list/records from the table.
  
NOTE:  If SET COMPATIBLE is set to FOXPRO | FOXPLUS | FOXBASE the array need not be pre-defined, it will be created automatically.
+
====<scope>====
 +
If no <scope> is specified, then the default is ALL.
  
 
====FIELDS <field list>====
 
====FIELDS <field list>====
Line 30: Line 30:
 
====WHILE <condition>====
 
====WHILE <condition>====
 
The WHILE clause will copy records so long as the <condition> is true (.T.), and is used to restrict the range of records processed.  When used in conjunction with the SEEK or LOCATE commands, it allows a quick way of copying selected records.  When the WHILE clause is used, the <scope> will default to REST.
 
The WHILE clause will copy records so long as the <condition> is true (.T.), and is used to restrict the range of records processed.  When used in conjunction with the SEEK or LOCATE commands, it allows a quick way of copying selected records.  When the WHILE clause is used, the <scope> will default to REST.
 
  
 
==Example==
 
==Example==
Line 39: Line 38:
 
</code>
 
</code>
  
 
==Products==
 
Recital Server, Recital
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
[[Category:Table Basics]]
+
[[Category:Declaring Variables and Arrays]]
[[Category:Table Basics Commands]]
+
[[Category:NoSQL Commands]]
[[Category:Array Processing]]
+
[[Category:Data Export]]
[[Category:Array Processing Commands]]
+

Latest revision as of 08:05, 10 February 2017

Purpose

Copy current table to an array

Syntax

COPY TO ARRAY <array>

[<scope>]

[FIELDS <field list>]

[FOR <condition>]

[WHILE <condition>]

See Also

AAVERAGE(), ACOPY(), ADEL(), ADIR(), AFIELDS(), AFILL(), AINS(), ALEN(), AMAX(), AMIN(), APPEND FROM ARRAY, ASCAN(), ASORT(), ASUM(), AVERAGE, DECLARE, DIMENSION, GATHER, IN_ARRAY(), IS_ARRAY(), LOCAL, PRIVATE, PUBLIC, RELEASE, RESTORE, SAVE, SCATTER

Description

The COPY TO ARRAY command allows all or part of the active table to be copied to the specified two-dimensional array, <array>. The target array will be created or resized to accommodate the field list/records from the table.

<scope>

If no <scope> is specified, then the default is ALL.

FIELDS <field list>

The optional FIELDS clause restricts the operation to those fields listed in <field list>. The <field list> contains a comma-separated list of field names.

FOR <condition>

The optional FOR clause restricts the operation to those records that match the specified <condition>.

WHILE <condition>

The WHILE clause will copy records so long as the <condition> is true (.T.), and is used to restrict the range of records processed. When used in conjunction with the SEEK or LOCATE commands, it allows a quick way of copying selected records. When the WHILE clause is used, the <scope> will default to REST.

Example

declare orders[10000,10]
use suppliers
copy to array orders for ord_date < date()