4D v16.3

VARIABLE TO VARIABLE

Home

 
4D v16.3
VARIABLE TO VARIABLE

VARIABLE TO VARIABLE 


 

VARIABLE TO VARIABLE ( process ; dstVar ; srcVar {; dstVar2 ; srcVar2 ; ... ; dstVarN ; srcVarN} ) 
Parameter Type   Description
process  Longint in Destination process number
dstVar  Variable in Destination variable
srcVar  Variable in Source variable

The VARIABLE TO VARIABLE command writes the dstVar process variables (dstVar2, etc.) of the destination process whose number is passed in process using the values of the variables srcVar1 srcVar2, etc.

VARIABLE TO VARIABLE has the same action as SET PROCESS VARIABLE, with the following differences:

  • You pass source expressions to SET PROCESS VARIABLE, and therefore cannot pass an array as a whole. You must exclusively pass source variables to VARIABLE TO VARIABLE, and therefore can pass an array as a whole.
  • Each destination variable of SET PROCESS VARIABLE can be a variable or an array element, but cannot be an array as a whole. Each destination variable of VARIABLE TO VARIABLE can be a variable or an array or an array element.

4D Server: “Intermachine” process communication, provided by the commands GET PROCESS VARIABLE, SET PROCESS VARIABLE and VARIABLE TO VARIABLE, is possible from client to server only. It is always a client process that reads or write the variables of a stored procedure.

For each couple of dstVar;expr variables, the source variable must be of a type compatible with the destination variable, otherwise you may end up with a meaningless value in the variable. In interpreted mode, if a destination variable does not exist, it is created and assigned with the type and value of the source variable.

The current process “pokes” the variables of the destination process—the destination process is not warned in any way that another process is writing the instance of its variables.

VARIABLE TO VARIABLE does not accept local variables as destination variables.

VARIABLE TO VARIABLE accepts any type of destination process or interprocess variables except:

  • Pointers
  • Array of pointers
  • Two-dimensional arrays

The destination process must be a user process; it cannot be a kernel process. If the destination process does not exist, an error is generated. You can catch this error using an error-handling method installed with ON ERR CALL.

Example  

The following example reads a process array from the process indicated by $vlProcess, sequentially sets the elements to uppercase and then writes back the array as a whole:

 GET PROCESS VARIABLE($vlProcess;at_IPCom_Array;$anArray)
 For($vlElem;1;Size of array($anArray))
    $anArray{$vlElem}:=Uppercase($anArray{$vlElem})
 End for
 VARIABLE TO VARIABLE($vlProcess;at_IPCom_Array;$anArray)



See also 

GET PROCESS VARIABLE
Processes
SET PROCESS VARIABLE

 
PROPERTIES 

Product: 4D
Theme: Process (Communications)
Number: 635

Different in remote mode

 
HISTORY 

Created: 4D v6

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)