undeclare

Force the specified ProcScript module to be ignored during compilation.

undeclare  ModuleType  ModuleName

Example: undeclare trigger error

Parameters

Parameters

Parameter

Data Type

Description

ModuleType

String

Type of ProcScript module; one of trigger, operation, or entry.

ModuleName

String

Name of a ProcScript module of the specified type.

Use

Allowed in all component types.

Description

Use the undeclare command to instruct the Uniface compiler to ignore all preceding declarations of the specified ProcScript module so that they do not compile. For triggers that have default behavior, this forces the trigger to fall back to its default behavior. This is normally to do nothing, but some triggers perform an action. For more information, see Triggers with Default Behavior.

Triggers and operations have a namespace, so they can only be undeclared in that same namespace. For example, if an entity named ORDER.SALES has an Occurrence Operation named CalculateAmount, that operation can only be undeclared in the Occurrence Script container of ORDER.SALES.

The undeclare command implicitly terminates the preceding ProcScript module, if it does not have an explicit end command.

When a ProcScript module is undeclared, it does not appear in the Compiled Modules Inspector or in ProcScript listings. The undeclare command itself appears in ProcScript listings if you compile with listings enabled. For more information, see Script Listings.

If the compiler subsequently encounters a declaration of a module that has already been undeclared, it generates a warning message. It is assumed that if a module has been undeclared (typically, to make a trigger revert to its default behavior), declaring the module again is probably a mistake.

Undeclaring a module may result in compilation warnings. For example, if an undeclared module is called or activated from code, the compiler warns that it could not find the module.

Undeclaring ProcScript Modules

Undeclaring a local trigger

Undeclare a trigger only after it has been declared:

;Script container of a Component
; first declare the trigger
trigger print
  print
end
; then undeclare it
undeclare trigger print

The print trigger will not be compiled, and the behavior will revert to default behavior, which is to execute print/ask.

Undeclaring an inherited trigger

To undeclare an inherited trigger, you can do so in the script container of the object that inherits. For example, a trigger is defined in a modeled field:

;Script container of a Modeled Field
trigger detail
  askmess "Data is modified. Clear it?"
end

The field is inherited by a derived field in the component. The inherited code is not displayed in the derived component, but it can be undeclared:

; Script container of the Derived Field in the component 
undeclare trigger detail

The detail trigger is not compiled, and because it has no default behavior, no message box will be displayed when the user activates the field.

Undeclaring an operation

Operations can be undeclared in the trigger in which they are declared, or in the equivalent trigger of the derived object.

operation myOperation 
  ; some code 
end ; myOperation 

undeclare operation myOperation
Undeclaring an entry

Entries have component scope, but they can be declared in any script container of any development object in the component. Therefore, the location of the entry declaration and undeclare entry command can determine whether the entry is ignored by the compiler. If an entry is declared after it has been undeclared, the compiler issues a warning.

;Script container of Component
entry myEntry
  ; some code 
end ; myEntry 

undeclare entry myEntry

Note:  It is recommended that you define entries in the Script container of the component so they are easier to locate and maintain (and undeclare, if needed).

History

Version

Change

10.02.01 F106

Introduced

Related Topics