Difference between revisions of "AFIELDS()"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Class==
 
Array Processing
 
 
 
 
==Purpose==
 
==Purpose==
 
Function to fill a series of arrays with table structure details
 
Function to fill a series of arrays with table structure details
Line 14: Line 10:
  
 
==See Also==
 
==See Also==
[[AADD()]], [[AAVERAGE()]], [[ABROWSE()]], [[ACHOICE()]], [[ACOL()]], [[ACOPY()]], ]]ADEL()]], [[ADESC()]], [[ADIR()]], [[AELEMENT()]], [[AFILL()]], [[AINS()]], [[ALEN()]], [[AMAX()]], [[AMIN()]], [[APPEND FROM ARRAY]], [[AROW()]], [[ASCAN()]], [[ASIZE()]], [[ASORT()]], [[ASTORE()]], [[ASTRING()]], [[ASUBSCRIPT()]], [[ASUM(]]), [[COPY TO ARRAY]], [[DECLARE]], [[DIMENSION]], [[GATHER]], [[LOCAL]], [[PRIVATE]], [[PUBLIC]], [[RELEASE]], [[RESTORE]], [[SAVE]], [[SCATTER]], [[SET COMPATIBLE]]]]
+
[[AADD()]], [[AAVERAGE()]], [[ABROWSE()]], [[ACHOICE()]], [[ACOL()]], [[ACOPY()]], [[ADEL()]], [[ADESC()]], [[ADIR()]], [[AELEMENT()]], [[AFILL()]], [[AINS()]], [[ALEN()]], [[AMAX()]], [[AMIN()]], [[APPEND FROM ARRAY]], [[AROW()]], [[ARRAY()]], [[ASCAN()]], [[ASIZE()]], [[ASORT()]], [[ASTORE()]], [[ASTRING()]], [[ASUBSCRIPT()]], [[ASUM()]], [[COPY TO ARRAY]], [[DECLARE]], [[DIMENSION]], [[GATHER]], [[IN_ARRAY()]], [[IS_ARRAY()]], [[LOCAL]], [[PRIVATE]], [[PUBLIC]], [[RELEASE]], [[RESTORE]], [[SAVE]], [[SCATTER]], [[SET COMPATIBLE]]
  
  
Line 45: Line 41:
 
|1||Field name||Character
 
|1||Field name||Character
 
|-
 
|-
|2||Field type:
+
|valign="top"|2||Field type:
 +
 
 
C = Character
 
C = Character
 +
 
Y = Currency
 
Y = Currency
 +
 
D = Date
 
D = Date
 +
 
T = DateTime
 
T = DateTime
 +
 
B = Double
 
B = Double
 +
 
F = Float
 
F = Float
 +
 
G = General
 
G = General
 +
 
I = Integer
 
I = Integer
 +
 
L = Logical
 
L = Logical
 +
 
M = Memo
 
M = Memo
 +
 
N = Numeric
 
N = Numeric
 +
 
Q = Varbinary
 
Q = Varbinary
 +
 
V = Varchar and Varchar (Binary)
 
V = Varchar and Varchar (Binary)
W = Blob||Character
+
 
 +
W = Blob
 +
|valign="top"|Character
 
|-
 
|-
 
|3||Field width||Numeric
 
|3||Field width||Numeric
Line 111: Line 122:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital Server, Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 +
[[Category:Array Processing]]
 +
[[Category:Array Processing Functions]]

Latest revision as of 15:10, 26 October 2011

Purpose

Function to fill a series of arrays with table structure details


Syntax

AFIELDS(<array1> [,<array2> [,<array3> [,<array4>]]])

AFIELDS(<array> [,<workarea | alias>])


See Also

AADD(), AAVERAGE(), ABROWSE(), ACHOICE(), ACOL(), ACOPY(), ADEL(), ADESC(), ADIR(), AELEMENT(), AFILL(), AINS(), ALEN(), AMAX(), AMIN(), APPEND FROM ARRAY, AROW(), ARRAY(), ASCAN(), ASIZE(), ASORT(), ASTORE(), ASTRING(), ASUBSCRIPT(), ASUM(), COPY TO ARRAY, DECLARE, DIMENSION, GATHER, IN_ARRAY(), IS_ARRAY(), LOCAL, PRIVATE, PUBLIC, RELEASE, RESTORE, SAVE, SCATTER, SET COMPATIBLE


Description

The AFIELDS() function returns the number of fields in the table in the current workarea and loads the field names into an array, <array1>. The field types, field lengths and field decimals can also be loaded into individual arrays.


Parameters Description
<array1> The name of a pre-declared array in which to load the character string field name.
<array2> The name of a pre-defined array in which to load the field data types as character strings.
<array3> The name of a pre-defined array in which to load the field lengths as numeric values.
<array4> The name of a pre-defined array in which to load the field decimal places as numeric values. If the field is not a numeric data type or has no decimal places, then zero is returned.


The SET FIELDS command can be used to restrict the active fields and therefore determine which fields are copied into the array.

With SET COMPATIBLE set to FoxPro, Foxbase or VFP, the AFIELDS() function syntax conforms to Visual FoxPro behavior. The information detailed in the table below is loaded into the 18 columns of the single array <array>. Each row in the array corresponds to a field in the table. If the optional <workarea | alias> is specified, then the function will operate in the required location, otherwise it will operate in the current workarea.


Column Information Data Type
1 Field name Character
2 Field type:

C = Character

Y = Currency

D = Date

T = DateTime

B = Double

F = Float

G = General

I = Integer

L = Logical

M = Memo

N = Numeric

Q = Varbinary

V = Varchar and Varchar (Binary)

W = Blob

Character
3 Field width Numeric
4 Decimal places Numeric
5 Null values allowed Logical
6 Code page translation not allowed Logical
7 Field validation expression Character
8 Field validation text Character
9 Field default value Character
10 Table validation expression Character
11 Table validation text Character
12 Long table name Character
13 Insert trigger expression Character
14 Update trigger expression Character
15 Delete trigger expression Character
16 Table comment Character
17 NextValue for autoincrementing Numeric
18 Step for autoincrementing Numeric


Example

use patrons
declare tab1(12),tab2(12),tab3(12),tab4(12)
fields = afields(tab1,tab2,tab3,tab4)
 
//VFP example
set compatible to vfp
use orders in 0
use products in 0
nFIELDS = AFIELDS(array1,"orders")


Products

Recital Server, Recital