4D v16.3

Undefined

Home

 
4D v16.3
Undefined

Undefined 


 

Undefined ( variable ) -> Function result 
Parameter Type   Description
variable  Variable, Field in Variable to test
Function result  Boolean in True = Variable is currently undefined False = Variable is currently defined

Undefined returns True if variable has not been defined, and False if variable has been defined. A variable is defined if it has been created via a compilation directive or if a value is assigned to it. It is undefined in all other cases.

If the database has been compiled, the Undefined function returns False for all variables.

Example  

The following code manages the creation of processes when a menu item for a particular module of your application is chosen. If the process already exists, you bring it to the front; if it does not exist, you start it. To do so, for each module of the application, you maintain an interprocess variable ◊PID_... that you initialize in the On Startup database method.

When developing the database, you add new modules. Instead modifying the On Startup database method (to add the initialization of the corresponding ◊PID_...) and then reopening the database to reinitialize everything each time you add a module, you use the Undefined command to manage the addition of the new module, on the fly:

  //M_ADD_CUSTOMERS global procedure
 
 If(Undefined(◊PID_ADD_CUSTOMERS)) // Takes care of intermediate development stages
    C_LONGINT(◊PID_ADD_CUSTOMERS)
    ◊PID_ADD_CUSTOMERS:=0
 End if
 
 If(◊PID_ADD_CUSTOMERS=0)
    ◊PID_ADD_CUSTOMERS:=New process("P_ADD_CUSTOMERS";64*1024;"P_ADD_CUSTOMERS")
 Else
    SHOW PROCESS(◊PID_ADD_CUSTOMERS)
    BRING TO FRONT(◊PID_ADD_CUSTOMERS)
 End if
  //Note: P_ADD_CUSTOMERS, the process master method,
  // sets ◊PID_ADD_CUSTOMERS to zero when it ends.



See also 

CLEAR VARIABLE

 
PROPERTIES 

Product: 4D
Theme: Variables
Number: 82

This command can be run in preemptive processes

 
HISTORY 

Modified: 4D v11 SQL

 
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)