OBJECT()

From Recital Documentation Wiki
Revision as of 15:42, 17 November 2009 by Yvonnemilne (Talk | contribs)

Jump to: navigation, search

Purpose

Function to create an anonymous object


Syntax

OBJECT([[<property value> | <property name> => <property value> [,...]])


See Also

ADDPROPERTY(), ARRAY(), CLASS - Methods, CLASS - Parameters, CLASS - Properties, CLASS - Scoping, CREATEOBJECT(), DEFINE CLASS, DISPLAY CLASSES, DODEFAULT(), LIST CLASSES, METHOD, NEWOBJECT(), [[REMOVEPROPERTY()]


Description

The OBJECT() function is used to create an anonymous object. Properties are declared in a comma-separated list. Properties can be values only, <property value>, in which case they are given an automatically generated name: 00000001, 00000002 ... Property names can be specified using the <property name> => <property value> syntax. The OBJECT() function can also be included within the <property value> definition. The OBJECT() function returns an object.


Example

customer = object("custname" => "A Buyer Ltd.", ;
  "currentorder" => object("ord_id" => "00001", "ord_date" => date(),"ord_total" => 1599,;
  "orderitems" =>  object("10 reams A4 paper","500 business cards",;
                         "500 black ballpoint pens")))
display memory
 
Memory Variables:
------------------------
CUSTOMER                         Object (refptr OBJECT, refcnt 1)
.CUSTNAME                          Character 'A Buyer Ltd.'
.CURRENTORDER                     Object (refptr OBJECT, refcnt 0)
 .ORD_ID                            Character '00001'
 .ORD_DATE                          Date 11/17/2009
 .ORD_TOTAL                         Numeric 1599  (1599.000000000)
 .ORDERITEMS                       Object (refptr OBJECT, 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