Difference between revisions of "ARRAY()"
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | ==Purpose== | |
+ | Function to create a dynamic array | ||
+ | ==Syntax== | ||
+ | ARRAY([<element value> | <element name> => <element value> [,...]]) | ||
+ | |||
+ | |||
+ | ==See Also== | ||
+ | [[AADD()]], [[AAVERAGE()]], [[ABROWSE()]], [[ACHOICE()]], [[ACOL()]], [[ACOPY()]], [[ADEL()]], [[ADESC()]], [[ADIR()]], [[AELEMENT()]], [[AFIELDS()]], [[AFILL()]], [[AINS()]], [[ALEN()]], [[AMAX()]], [[AMIN()]], [[APPEND FROM ARRAY]], [[AROW()]], [[ASIZE()]], [[ASORT()]], [[ASTORE()]], [[ASTRING()]], [[ASUBSCRIPT()]], [[ASUM()]], [[COPY TO ARRAY]], [[DECLARE]], [[DIMENSION]], [[GATHER]], [[IN_ARRAY()]], [[IS_ARRAY()]], [[LOCAL]], [[NAMESPACE]], [[NAMESPACE()]], [[PRIVATE]], [[PUBLIC]], [[RELEASE]], [[RESTORE]], [[SAVE]], [[SCATTER]], [[SET EXACT]] | ||
+ | |||
+ | |||
+ | ==Description== | ||
+ | The ARRAY() function is used to create a dynamic array. Elements are declared as a comma-separated list. Elements can be values only, <element value>, in which case they are given an automatically generated name: 00000001, 00000002 ... Element names can be specified using the <element name> => <element value> syntax. Multi-dimensional arrays can be created by using the ARRAY() function in the <element value> definition. | ||
+ | |||
+ | |||
+ | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | customer = array(" | + | customer = array("custname" => "A Buyer Ltd.", ; |
"currentorder" => array("ord_id" => "00001", "ord_date" => date(),"ord_total" => 1599,; | "currentorder" => array("ord_id" => "00001", "ord_date" => date(),"ord_total" => 1599,; | ||
"orderitems" => array("10 reams A4 paper","500 business cards",; | "orderitems" => array("10 reams A4 paper","500 business cards",; | ||
Line 12: | Line 26: | ||
------------------------ | ------------------------ | ||
CUSTOMER Dynamic array (refptr ARRAY, refcnt 1) | CUSTOMER Dynamic array (refptr ARRAY, refcnt 1) | ||
− | . | + | .CUSTNAME Character 'A Buyer Ltd.' |
.CURRENTORDER Dynamic array (refptr ARRAY, refcnt 0) | .CURRENTORDER Dynamic array (refptr ARRAY, refcnt 0) | ||
.ORD_ID Character '00001' | .ORD_ID Character '00001' | ||
Line 22: | Line 36: | ||
.00000003 Character '500 black ballpoint pens' | .00000003 Character '500 black ballpoint pens' | ||
− | + | Total of 10 variables defined and 784 bytes used. | |
</code> | </code> | ||
+ | |||
+ | |||
+ | ==Products== | ||
+ | Recital, Recital Server | ||
+ | [[Category:Documentation]] | ||
+ | [[Category:Functions]] | ||
+ | [[Category:Array Processing]] | ||
+ | [[Category:Array Processing Functions]] |
Latest revision as of 13:29, 5 July 2011
Purpose
Function to create a dynamic array
Syntax
ARRAY([<element value> | <element name> => <element value> [,...]])
See Also
AADD(), AAVERAGE(), ABROWSE(), ACHOICE(), ACOL(), ACOPY(), ADEL(), ADESC(), ADIR(), AELEMENT(), AFIELDS(), AFILL(), AINS(), ALEN(), AMAX(), AMIN(), APPEND FROM ARRAY, AROW(), ASIZE(), ASORT(), ASTORE(), ASTRING(), ASUBSCRIPT(), ASUM(), COPY TO ARRAY, DECLARE, DIMENSION, GATHER, IN_ARRAY(), IS_ARRAY(), LOCAL, NAMESPACE, NAMESPACE(), PRIVATE, PUBLIC, RELEASE, RESTORE, SAVE, SCATTER, SET EXACT
Description
The ARRAY() function is used to create a dynamic array. Elements are declared as a comma-separated list. Elements can be values only, <element value>, in which case they are given an automatically generated name: 00000001, 00000002 ... Element names can be specified using the <element name> => <element value> syntax. Multi-dimensional arrays can be created by using the ARRAY() function in the <element value> definition.
Example
customer = array("custname" => "A Buyer Ltd.", ; "currentorder" => array("ord_id" => "00001", "ord_date" => date(),"ord_total" => 1599,; "orderitems" => array("10 reams A4 paper","500 business cards",; "500 black ballpoint pens"))) display memory Memory Variables: ------------------------ CUSTOMER Dynamic array (refptr ARRAY, refcnt 1) .CUSTNAME Character 'A Buyer Ltd.' .CURRENTORDER Dynamic array (refptr ARRAY, refcnt 0) .ORD_ID Character '00001' .ORD_DATE Date 11/04/2009 .ORD_TOTAL Numeric 1599 (1599.000000000) .ORDERITEMS Dynamic array (refptr ARRAY, refcnt 0) .00000001 Character '10 reams A4 paper' .00000002 Character '500 business cards' .00000003 Character '500 black ballpoint pens' Total of 10 variables defined and 784 bytes used.
Products
Recital, Recital Server