KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Passing object formulas using Shared Objects
PRODUCT: 4D | VERSION: 17 R | PLATFORM: Mac & Win
Published On: May 22, 2019
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

The feature set of objects have been expaned in v17R3 with the ability to create object funtions by assigning a formula as a method to an object. It is possible to use this feature on shared objects allowing the function to be useful outside the scope of a single process.

Example:

//Method1:

C_OBJECT($sharedObj)
$sharedObj:=New shared object("UPPER";New formula(Uppercase($1)))

$pid:=New process("Method2";0;"testProc";$sharedObj)


//Method2:
C_OBJECT($1;$sharedObj)
$sharedObj:=$1
$res_t:=$sharedObj.UPPER("hello world")

TRACE


When Method1 is executed it will pass on the shared object to Method2 opened in a new process allowing it access to the .UPPER() function created in the shared object. This feature can also be applied to Storage.