Description: Finds the zero-based index of the first reason whose custom entry equals a requested value.
Calling convention: CIP_GetReasonIndexByCustomEntryValue("ContainerName": String, "EntryName":String, EntryValue: Variant,["TargetObjectName": String], [TargetDataID])
Parameters:
ContainerName: reason-container entry name.
EntryName: custom reason entry to compare.
EntryValue: required comparison value.
TargetObjectName: optional target object; when supplied, TargetDataID must also be supplied.
TargetDataID: optional, non-NULL target record ID used together with TargetObjectName. The function accepts exactly three or five arguments.
Returns: Zero-based reason index, or -1 when no match exists. A four-argument call is rejected with a clear error.
Availability: Default; uses the active DBForm when possible, otherwise loads the target record.
Example:
ReasonIndex := CIP_GetReasonIndexByCustomEntryValue("Reason", "Category", "Mechanical");