Using the 4D Open for 4D Routines

4D - Documentation   Français   English   German   4D Open for 4D, Command Theme List   4D Open for 4D, Command Alphabetical List   Back   Previous   Next

version 6.0 (Modified)


All 4D Open for 4th Dimension (4D Open for 4D) plug-in routines are functions. Each function returns an error code result that tells you whether or not the operation was successfully performed. If the function returns 0, no error has occurred.

4D Open for 4D functions should always be assigned a Long Integer (Longint) variable that will receive the error code. The following code shows you how to use a 4D Open for 4D function:

       ` Do something and get error code result
   $errCode:=OP Load network component (<>ADSPNetComp)

Some 4D Open for 4D routines such as OP Get network component info return values as well as error codes. The values are returned in the parameters, and the error code is returned in the Longint variable assigned to the routine. In the following line of code, the error code is returned in $errCode, and the values returned by the routine are placed into the NCID and NCName parameters (which have been previously declared). The NC parameter is the network component number passed to this function to retrieve information about it in the other two parameters: NCID and NCName.

   $errCode:=OP Get network component info (NC;NCID;NCName)

Nature of the parameters passed to 4D Open for 4D routines

The types of parameters passed to a routine depend on whether the routine returns a value in the parameter and whether or not the parameter refers to a 4th Dimension object.

Parameters not returning a value

You can pass an expression, a field, a variable (local, process, or interprocess) or an array (process or interprocess).

You cannot pass local arrays.

Since you are working in a multi-process environment, if you pass interprocess variables or arrays, be sure to protect the use of these variables and arrays by using local semaphores.

Examples:

   $ErrCode:=OP Load network component (1)
   $ErrCode:=OP Load network component (GetCompID("ADSP"))
   $ErrCode:=OP Load network component ([Components]Component ID)
   $ErrCode:=OP Load network component ($NCID)
   $ErrCode:=OP Load network component (NCID)
   $ErrCode:=OP Load network component (<>NCID)
   $ErrCode:=OP Enter password (arUser;$UserName;$Password)
   $ErrCode:=OP Enter password (<>arUser;$UserName;$Password)

Parameters returning a value

You can pass a field, a variable (local, process, or interprocess) or an array (process or interprocess).

You cannot pass local arrays.

Since you are working in a multi-process environment, if you pass interprocess variables or arrays, be sure to protect the use of these variables and arrays by using local semaphores.

Examples:

   $ErrCode:=OP Count tables ($ConnID;[Servers]NbFiles)
   $ErrCode:=OP Count tables ($ConnID;$NbFiles)
   $ErrCode:=OP Count tables ($ConnID;NbFiles)
   $ErrCode:=OP Count tables ($ConnID;<>NbFiles)
   $ErrCode:=OP Get all tablenames ($ConnID;arFName)
   $ErrCode:=OP Get all tablenames ($ConnID;<>arFName)

Parameters referring to a 4D object (fields, variables, arrays)

You can pass a reference to a field (pointer or number) or to a process or interprocess variable or array (pointer or name).

You cannot pass a pointer to an array element.

You cannot pass a reference to a local variable or array.

Since you are working in a multi-process environment, if you pass interprocess variables or arrays, be sure to protect the use of these variables and arrays by using local semaphores.

Note: You can get/set BLOB fields in the same way you do it with other fields.

Examples:

   $ErrCode:=OP Single query ($ConnID;$FileID;$FieldID;"=";»[Data]Value;$NbFound)
   $ErrCode:=OP Single query ($ConnID;$FileID;$FieldID;"=";»vValue;$NbFound)
   $ErrCode:=OP Single query ($ConnID;$FileID;$FieldID;"=";»<>vValue;$NbFo und)
   $ErrCode:=OP Define bind by numbers ($BindID;10;4;2;4;"") 
   $ErrCode:=OP Define bind by numbers ($BindID;10;4;0;0;"vName")
   $ErrCode:=OP Define bind by numbers ($BindID;10;4;0;0;"<>vName")
   $ErrCode:=OP Define bind by numbers ($BindID;10;4;0;0;"arValue")
   $ErrCode:=OP Define bind by numbers ($BindID;10;4;0;0;"<>arValue")
   $ErrCode:=OP Define bind by pointer ($BindID;10;4;»vName)
   $ErrCode:=OP Define bind by pointer ($BindID;10;4;»<>vName)
   $ErrCode:=OP Define bind by pointer ($BindID;10;4;»arValue)
   $ErrCode:=OP Define bind by pointer ($BindID;10;4;»<>arValue)

What you should know

To use 4D Open for 4D, you should be familiar with the 4th Dimension programming language.

What you need

To use 4D Open for 4D 6.5, you must have 4D Server version 6.5 or later and either 4D Client version 6.5 or later or 4th Dimension version 6.5 or later.

You also need to install the network component(s) that correspond with the network protocol(s) that you wish to use. For more information, please refer to the Network Components for 4D Server manual.


4D - Documentation   Français   English   German   4D Open for 4D, Command Theme List   4D Open for 4D, Command Alphabetical List   Back   Previous   Next