Difference between revisions of "ARRAY()"

From Recital Documentation Wiki
Jump to: navigation, search
Line 1: Line 1:
{{YLM to do}}
+
==Purpose==
 +
Function to declare 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]], [[LOCAL]], [[PRIVATE]], [[PUBLIC]], [[RELEASE]], [[RESTORE]], [[SAVE]], [[SCATTER]], [[SET EXACT]]
 +
 +
 +
==Description==
 +
The ARRAY() function is used to declare 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("name" => "A Buyer Ltd.", ;
 
customer = array("name" => "A Buyer Ltd.", ;
Line 24: Line 38:
 
** Total of ** 10 variables defined and 784 bytes used.
 
** 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]]

Revision as of 17:05, 4 November 2009

Purpose

Function to declare 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, LOCAL, PRIVATE, PUBLIC, RELEASE, RESTORE, SAVE, SCATTER, SET EXACT


Description

The ARRAY() function is used to declare 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("name" => "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)
.NAME                              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 use
** Total of ** 10 variables defined and 784 bytes used.


Products

Recital, Recital Server