| # To configure an attached condition script To create a condition script for a trigger: Start the Triggers (datrg1100m000) session and change the trigger's Condition Template to 'Attached Script'. Run the Configure Conditions command. The text editor is started. Enter the required Baan C code. When you leave the text editor and return to the Triggers (datrg1100m000) session, the trigger program is regenerated automatically, if the text was changed. When you change the Condition Template from 'Attached Script' to another setting, the text content is not deleted. So when you switch back to the 'Attached Script'Condition Template, the existing text is used. The first time you run the Configure Conditions command, for a trigger with Condition Template = 'Attached Script', the system generates a default template with the following content:
    function extern long check.conditions(long i.event, ref boolean
                                            o.condition.is.met)
    | IMPORTANT: do not change the interface (function name, parameters,
    | and  return value)
    {
    DLLUSAGE
    Desc            This function checks whether a trigger event meets the
                    specified conditions.
    Input           i.event: event
    Output          return value: 0 (OK) or < 0 (an error value)
                    o.condition.is.met: whether the event matches the
                    specified condition(s)
    Precondition:   i.event contains an event that is formatted according
                    to library datrgevent and must be read using that
                    library.
    ENDDLLUSAGE

            | < Add implementation here > |

            o.condition.is.met = true
            return(0) | OK
    }
TO CUSTOMIZE A GENERATED PROGRAM Instead of writing a condition function from scratch, you can customize a generated script. This is useful if you want to create conditions that are too complicated to be defined in the Configure Trigger Conditions (datrg1110m000) session. Two examples where the user interface functionality of this session falls short: In a condition you cannot specify that a trigger must be executed if the ordered quantity for an item increases. In a condition you cannot specify that a trigger must be executed if the Inventory Allocated exceeds the Inventory on Hand (because both are attributes). In these cases it is advisable to first use the Configure Trigger Conditions (datrg1110m000) session to define conditions that as much as possible resemble your needs. For example, if you want to specify that a trigger must be executed if a quantity increases, you can initially use the Configure Trigger Conditions (datrg1110m000) session to define a condition that specifies that a trigger must be executed if the quantity is changed. Assume you configured Trigger Conditions, through the Configure Trigger Conditions (datrg1110m000) session, for a trigger. In that case a generated program is available in the Path for Program that is specified for the trigger; the file name is <path>/<trigger>.src. Take the following steps to copy the code from the generated script to a new condition script: Open the generated script and copy the check.conditions() function from that source to the Windows clipboard. Start the Triggers (datrg1100m000) session, change the trigger's Condition Template to 'Attached Script', and run The Configure Conditions command. The Text Editor is started. Paste the copied contents from the clipboard into the standard condition template that is displayed in the Text Editor. Adapt the script until it meets your requirements. Note The system does not perform an automatic merge of the attached condition script and the condition defined in the Configure Trigger Conditions (datrg1110m000) session. For example, you change the Condition Template to 'Configure via Dialog'. Subsequently you update the condition in the Configure Trigger Conditions (datrg1110m000) session, and finally you switch back to 'Attached Script' mode. The attached script is NOT updated automatically. |