$dataerrorcontext

Return the context of the last validation error.

$dataerrorcontext

Return Values

Associative list that describes the context in which the error occurred.

Associative list items returned by $dataerrorcontext
Item Meaning
CONTEXT=VALIDATION The error occurred during validation.
TOPIC=FIELD Error occurred during a procedural check in a field-level validate trigger.
TOPIC=KEY Error occurred during a procedural check in a validateKey trigger.
TOPIC=OCC Error occurred during a procedural check in an entity-level validate trigger.
TOPIC=SYNTAX Error occurred during a declarative check.
OCC= OccurrenceNumber Occurrence number where error occurred.
KEY= KeyNumber When TOPIC=KEY, the key number that caused the error.

Otherwise, omitted.

OBJECT= FieldName Fully-qualified name of the field in which the error occurred, in uppercase characters.
OBJECT= EntityName Fully-qualified name of the entity in which the error occurred, in uppercase characters.
ERROR= ErrorValue Value of $error.
STATUS= StatusValue Fully-qualified name of the alue of $status. Typically this is a negative value.

Use

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

Non-Contiguous Range Check

The following example uses the $dataerrorcontext function in the triggers of a field:

; ------------------------
trigger validate
; Example: non-contiguous range check

if (DISCOUNT = -100 | (DISCOUNT >= 0 & DISCOUNT <= 100))
   return(0)
else
   return(-1)
endif
done
end; validate

; ------------------------
trigger loseFocus

if ($fieldendmod)
   if (CUSTCODE = "Special")
      $prompt = SPECIAL_DISCOUNT
      field_syntax DISCOUNT, "DIM"
   else
      field_syntax DISCOUNT, ""
   endif
   if ($status = -1) message $text(1234)
endif
done
end; loseFocus

; ------------------------
trigger error 

variables
   string problem
endvariables
getitem/id problem, $dataerrorcontext, "topic"
message "You have a %%problem%%% problem to resolve."
return(-1)
end; error

Related Topics