Create - Create an instance of an object
This action is used when we want to ensure an object instance is created at a specific timing.
Typical situations when Create is useful:
- Conditionally creating an object instance. A typical example is the creation of a display element
based on some configuration details or according to user input (the screen display changes dynamically).
See Usage Example 1 below.
- Ensuring an object instance exists. Sometimes an object
instance (typically an instance of a data structure) is not created
before data is assigned to at least one of its elements. If we want to
ensure it is created earlier, Create will create the instance “empty”.
See Usage Example 2 below.
- Postponing the creation of an object instance. Use Create, in conjunction with alwaysCreate
local property, if the creation of an instance should be postponed to a
later stage (to speed earlier processes by using just-in-time creation,
or to ensure an instance is created only after some preconditions are
met).
See Usage Example 3 below.
- When an instance of variable type should be created. In this case, the <Model Id> trigger is required,
and <Object> would typically be of type Anything.
Triggers
<Model Id> (non-repetitive text trigger [not required]):
The id of the model for which we want to create an instance
(the value of the ‘id’ shared property of the model).
- This trigger is implemented on the client side only.
If missing (or on the server side), the type of <Object> is used.
Exits
<Object> (non-repetitive exit [required]):
The created instance (all its data elements are empty).
If <Model Id> is provided (supported on the client side only),
<Object> can be of type Anything.
<Model Not Found> (non-repetitive text exit [not required]):
The value of <Model Id> in case it is specified but there is no such model in the application.
Usage Example 1 - Conditional creation of display elements
"Common/Templates/Modules/Rich Table/Template/Init/Count Display Elements in Table Row":
Usage Example 2 - Creating an empty data structure
"Examples/Web Services/Web Services - Holidays/Get Countries/Get Countries" in the "Examples" project:
Usage Example 3 - Controlling the appearance of tabs in a tabbed pane
When a Tabbed Pane
is included in a view, all its tabs are included and initialized at
once. There are situations where certain tabs should not appear at
first, but rather added when certain conditions are met, either because
they are initially irrelevant, or because they are optional and
postponing their initialization will improve performance of the view as
a whole.