$curkey

Return the number of the current key in a validateKey or leaveModifiedKey trigger.

$curkey

Return Values

Values Returned by $curkey
Value  Meaning
1 Primary key
>1 Key number of a candidate key
"" An error occurred
Values returned by $procerror following $curkey
Value  Error constant Meaning
-1304 <UPROCERR_UNKNOWN_CONTEXT> Function not allowed, unknown context. For example, $curkey was encountered in an incorrect trigger.

Use

Allowed only in a validateKey or leaveModifiedKey trigger.

Allowed in all component types, except self-contained Reports.

Description

The $curkey function returns the key number in the current occurrence for which the validateKey or leaveModifiedKey trigger was activated.

Example: Validating Keys and Error Handling

The following example uses the $curkey function to perform specific validation for each key and otherwise reports the error and context using $procerror and $procerrorcontext.

trigger validateKey

selectcase $curkey
   case 1 ;perform validation for the primary key
   ...
   case 2 ;perform validation for candidate key #2
...
   case 4 ;perform validation for candidate key #4
...
   elsecase
      message "Error %%$procerror occurred at %%$procerrorcontext"
      message "Context: %%$dataerrorcontext"
endselectcase
end; validateKey

Related Topics