CREATE Function (Automation)
Creates an Automation object.
[Ok :=] CREATE(Automation [,NewServer] [,OnClient])
Parameters
- Automation
-
Type: Automation
A variable that has previously been declared.
- NewServer
-
Type: Boolean
If NewServer is false (the default), CREATE will try to reuse an already running instance of the automation server referenced by Automation before creating a new instance. If NewServer is true, CREATE will always create a new instance of the automation server.
- OnClient
-
Type: Boolean
If OnClient is false (the default), then the Automation object is created on the Microsoft Dynamics NAV Server. If OnClient is true, then the Automation object is created on the client.
This parameter is only valid when you run the function on the RoleTailored client. On the Classic client, the Automation object is always created on the client.
CREATE creates (instantiates) the automation server referenced by the Automation variable. While an OCX (custom control) is instantiated implicitly, Automation variables must be created explicitly.
If you have an array of OCXs, each control will be created when its first member is accessed.
If you have an array of automation servers, you have to call CREATE on each element individually. The NewServer variable can be used independently on each element.
The automation object that is created can be explicitly destroyed by the CLEAR Function. The object will be destroyed implicitly when the Automation variable goes out of scope.
An Automation variable can only be created once. You will get a run-time error if you try to create an Automation a second time, without calling CLEAR first. You will also get a run-time error if you try to create an OCX variable.