Description: Adds a reason to the current visible record in the three-argument form, or to a specified visible or offline record when ObjectName and RecordID are supplied.
Calling convention: AddReason("DestContainerName": String, ReasonID: Integer, Duration: Float, ["ObjectName": String], [RecordID: Integer], ["Remark": String]): Variant
Parameters:
DestContainerName: reason or reason-volume container.
ReasonID: existing global reason ID.
Duration: reason duration.
ObjectName: target object for the extended form.
RecordID: target DATA_ID for the extended form.
Remark: optional text up to 255 characters.
Returns: Reported zero-based index of the inserted reason, or NULL on selected failures. For offline records the index is calculated from all reason rows of the record, not only the target container.
Availability: Default; accepts exactly 3, 5 or 6 arguments. The three-argument form requires a current visible record.
Example:
ReasonIndex := AddReason("DowntimeReasons", 120, 900, "DailyProduction", DataID, "Pump stopped");