This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20.6
New shared object

New shared object 


 

New shared object {( property ; value {; property2 ; value2 ; ... ; propertyN ; valueN} )} -> Function result 
Parameter Type   Description
property  Text in Name of property to create
value  Text, Date, Boolean, Pointer, Number, Object in Value of property
Function result  Object in New shared object

The New shared object command creates a new empty or prefilled shared object and returns its reference. Adding or editing a property to this object must be surrounded by the Use...End use structure, otherwise an error is generated. Reading a property without a Use...End use structure is, however, possible.

Note: For more information on shared objects, please refer to the Shared objects and shared collections page.

If you do not pass any parameters, New shared object creates an empty object and returns its reference. You must assign this reference to a 4D variable declared with the C_OBJECT command.

Note: C_OBJECT declares a variable of the Object type but does not create an object.

Optionally, you can prefill the new object by passing one or several property/value pairs as parameters:

  • In the property parameter, pass the label of the property to be created (up to 255 characters). Note that the property parameter is case sensitive. 
  • In the value parameter, pass the value you want to set for the property. Shared objects can only contain values of the following types:
    • number (real, longint...) Number values are always stored as reals.
    • text
    • boolean
    • date
    • time (stored as number of milliseconds - real)
    • null
    • shared object(*)
    • shared collection(*)

    Note: Unlike standard (not shared) objects, shared objects do not support pictures, pointers, and objects or collections that are not shared.

    (*)When a shared object or collection is added to a shared object, they share the same locking identifier. For more information on this point, refer to the About the locking identifier (how shared groups work) section.

You want to create a new prefilled shared object:

 C_OBJECT($contact)
 $contact:=New shared object("name";"Smith";"firstname";"John")

You want to create and modify a shared object. The structure must be called for this object

 C_OBJECT($s_obj)
 $s_obj:=New shared object("prop1";"alpha")
 Use($s_obj)
    $s_obj.prop1:="omega"
 End use



See also 

New object
New shared collection
Shared objects and shared collections

 
PROPERTIES 

Product: 4D
Theme: Objects (Language)
Number: 1526

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v16 R6

 
ARTICLE USAGE

4D Language Reference ( 4D v20)
4D Language Reference ( 4D v20.1)
4D Language Reference ( 4D v20.2)
4D Language Reference ( 4D v20.3)
4D Language Reference ( 4D v20.4)
4D Language Reference ( 4D v20.5)
4D Language Reference ( 4D v20.6)