A new feature introduced in 4D v18 R5 is how entity selections are managed between processes.
Entity selections can be one of two types, alterable or shareable. These types can be thought of as alterable as read/write and sharable as read-only and is important for its use-case between processes.
Alterable entity selections cannot be shared between processes, attepting to do so will trigger an error. But within it's process it can be modified (such as adding new entities).
Shareable entity selections cannot be modified and can only be read. But they are able to be passed to other processes as a parameter or stored in shared objects of collections.
To check the entity's type, .isAlterable() function is available for entity selections. This function will return a boolean True if the entity selection is an alterable entity selection and false if it is a sharable entity selection.
If(myEntitySel.isAlterable() = False) // myEntitySel is an alterable entity selection Else // myEntitySel is an shareable entity selection End if |
To convert the entity selection's type, a new entity selection must be create using the .copy() function. The function can take one parameter. If the parameter is ommitted the function returns an alterable entity selection. To create a shareable entity selection pass the constant ck shared.
// Alterable to Shareable shareableEntSel:=alterableEntSel.copy(ck shared) |
// Shareable to Alterable alterableEntSel:=shareableEntSel.copy() |