KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Non-Shared Objects/Collections Can't be added to Shared Objects/Collections
PRODUCT: 4D | VERSION: 17 | PLATFORM: Mac & Win
Published On: September 20, 2019

Non-shared object/collection types cannot be added to a shared object property or a shared collection index property.

In the example code below, a non-shared object is trying to be added inside the shared object property "Name". This will not work because shared object properties do not not accept non-shared object/collection as its value type. The same behavior is present when trying to add a non-shared object/collection to a shared collection index property as well. When this action is performed, an error message will appear stating, "Not suported value type in a shared object or a shared collection".

$sharedOb:=New shared object("Name";"AAA")
$Non_SharedOb:=New object("Name";"BBB")

Use ($sharedOb)
$sharedOb.Name:=$Non_SharedOb
End use


To add an object/collection inside the property or index of another object/collection, they must:
  • Both be a non-shared object/collection
  • Both be a shared object/collection
  • The non-shared object property/collection index must be the one accepting the shared-object/collection (Does not work the other way around)

This behavior applies between and across objects/collections.