| **Navigation:**  [[templates.htm|Templates]] > [[templates by topic.htm|Templates by Topic]] > Business Rules > Local Support >====== Local Business Rules - Code Template Error Handler ====== | [[tplextensionlocalbusinessrulebases.htm|{{btn_prev_n.gif|Previous page}}]][[templates by topic.htm|{{btn_home_n.gif|Return to chapter overview}}]][[tplextensionlocalbusinessruleshotfields.htm|{{btn_next_n.gif|Next page}}]] | | || The Business Rules Handler Code Template is your key to evaluating a defined business rule at any point within your application. Simply include this template at any available embed point, and set the functions and other optional responses when a rule is broken. **Rules to check** Select from **All** (Global and Local), **Global** (Global Only), and **Local** (Local Only) rules to check. By selecting **Global** or **Local**, you can also check an individual rule only. **Rulebase Name** Select a rulebase name to process by the Business Rules Handler. The rulebase names that you see are based on what types you designated in the **Rules to check** prompt **Select Function** The rules handler can perform a variety of functions for you to select from. **Count Broken Rules** Select this function to return a count of broken rules to the designated destination variable. **Destination Variable** Press the ellipsis button to select a variable name or expression that will hold the count of broken rules. Press the "**E**" button to call the Expression Editor. This dialog is used to help you construct syntactically correct expressions to use in the **Destination Variable** prompt. **UPDATE( ) screen before checking rule.** Check this box to force all screen USE variable values to the appropriate memory buffer prior to performing the count function. **Check All rules** Select this function to check all of the business rules designated in the** Rulebase Name**. A Broken rule count will be sent to the Destination Variable. **Destination Variable** Press the ellipsis button to select a variable name or expression that will hold the count of broken rules as all rules are checked. Press the "**E**" button to call the Expression Editor. This dialog is used to help you construct syntactically correct expressions to use in the **Destination Variable** prompt. **Modify error indicator** When a rule is broken, there are global settings that can be set to handle an rule error that is encountered. Check this box to bypass these global settings. **UPDATE() screen before checking rule.** Check this box to force all screen USE variable values to their appropriate memory buffer prior to performing the rules check function. **DISPLAY() screen after checking rule** Check this box to force a refresh of all screen variables from memory after the rules check is completed. **List Broken Rules** Select this function to display a list of all broken rules defined within the selected **Rulebase Name**. This function assumes that a rules check has already been performed. There are no other secondary prompts associated with this function. When the list is displayed, you are presented with a "tree" of rules. You can highlight (select) any broken rule, and press the **Go To' **button to jump to the screen variable that the rule is associated with. **Check and List Broken Rules** Select this function to display a list of all broken rules defined within the selected **Rulebase Name**. This function will perform a rules check prior to the display. There are no other secondary prompts associated with this function. **Check and List All Rules** Select this function to display a list of all rules defined within the selected **Rulebase Name**. This function will perform a rules check prior to the display. There are no other secondary prompts associated with this function. **Check a rule** This function is only available when you have selected the Global or Local option in the **Rules to check** prompt. **Destination Variable** Press the ellipsis button to select a variable name that will hold the result of the rule check. A value of one (1) is returned if the rule is broken (e.g., evaluates to "False".) **RuleName** Select a rule name from the drop list to check. This list is filtered based on the Rulebase Name you have chosen. **Modify error indicator** When a rule is broken, there are global settings that can be set to handle an rule error that is encountered. Check this box to bypass these global settings. **UPDATE() screen before checking rule.** Check this box to force all screen USE variable values to their appropriate memory buffer prior to performing the rule check. **DISPLAY() screen after checking rule** Check this box to force a refresh of all screen variables from memory after the rule check is completed. **Business Rules Handler Prompts** The Business Rules Handler Prompts designate specific actions that you wish to take when a rule is evaluated to "True" (passes) or "False" (rule is broken). ** Copy to True/False** When you designate a specific action to apply to a rule, press this button to copy the prompt values to the action's counterpart. **Assign Values** Lets you assign values to variables based on the state of the rule check. You may specify multiple assignments. Press the Insert button to add a new assignment. **Variable to Assign** In the entry box, type a variable name, or press the ellipsis (...) button to choose or create a data dictionary field or a memory variable with the Select Field dialog. **Value to Assign** In the entry box, type the value to assign to the variable. You can then add code to your program to take appropriate action based on the run time value of the variable(s). **Hide/Unhide Controls** Lets you specify window controls to hide or unhide based on the on the state of the rule check.. You may specify multiple controls to hide/unhide. Press the Insert button to add a new hide/unhide action to the list. **Control to hide/unhide** From the drop down list, choose the control to HIDE or UNHIDE. **Hide or unhide control** From the drop down list, choose Hide or Unhide. **Enable/Disable Controls** Lets you specify window controls to enable or disable based on the state of the rule check. You may specify multiple controls to enable/disable. Press the Insert button to add a new enable/disable action to the list. **Control to enable/disable** From the drop down list, choose the control to ENABLE or DISABLE. **Enable or Disable control** From the drop down list, choose Enable or Disable. **Display a Message** Lets you specify a message box to display based on the state of the rule check. **Enable Message** Check this box to enable the prompts shown below. . **Title** Enter the name of the title to use in the Message window. **Message** Enter the message text. **Icon** Select an optional icon to use in the message box. **Button** Select from the drop list the name of the button that you wish to use for the message box. ** ** ** Routines/Procedure/Code** Lets you call a selected source code process to execute based on the state of the rule check. You may specify multiple source code calls. Press the Insert button to add a new action to the list **Type** Select from **Routine**, **Procedure**, or **Code** ** Routine** ** **Active when Routine type is selected. Enter a valid ROUTINE name here. **Procedure** Active when Procedure type is selected. From the **Procedure** drop down list, choose an existing procedure name, or type a new procedure name. A new procedure appears as a "ToDo" item in your Application Tree. You can also optionally specify a **parameters** list and a **return variable** (as prototyped). **Code** Active when Code type is selected. Enter your custom source code in the text field provided.