ACTIVE Function (KeyRef)

Indicates whether the key is enabled.


Ok := KeyRef.ACTIVE  


Type: KeyRef

The keyref that refers to a key.

Property Value/Return Value

Type: Boolean

true if the key is enabled; otherwise, false.


The following example uses the KeyRef.ACTIVE function to determine whether a key in a record is enabled. The table with ID 18 (the Customer table) is open with a reference to table 18. The KEYINDEX Function (RecordRef) function retrieves the first key in the record and the varKeyRef.ACTIVE function returns a Boolean value that indicates whether the retrieved key is enabled. The Boolean value is displayed in a message box. This example requires that you create the following variables in the C/AL Globals window.

Variable name DataType
RecRef RecordRef
varKeyRef KeyRef
IsActive Boolean

varKeyRef := RecRef.KEYINDEX(1);  
IsActive := varKeyRef.ACTIVE;  
MESSAGE('Is the key active =  %1 ', IsActive);  

See Also

KeyRef Data Type