Scenario: Vacation information for all employees is stored in a database. This information includes how many vacation days each employee has left. The employees often forget how many days they have left and tend to believe they have more than less. When requesting days off, sometimes they ask for more days than they have left. Instead of a disappointing meeting with the manager, the Compare Numbers Rule component compares the requested vacation days against the number of days allowed, and informs the employee that he or she needs to revise the request and try again.
Process: This process is created as a Webforms-type project.
The following screen shot shows the process:
After the employee submits the vacation request, a custom component looks the employee up in the database and returns with the number of vacation days left.
The Compare Numbers Rule component compares the number of days the employee requested with the number of days left on the account.
If the employee has not requested too many days, an email is sent to the employee's manager. If the employee requested too many days off, an Add New Data Element component (renamed "Nice Try") adds an error message to the webform.
The following screen shot shows the editor for the Add New Data Element:
Here we see that the Add New Data Element component creates a text variable called TooManyDaysErrorMessage that has an error message for the value: You have requested more days than are allotted to your account. The Form Builder component displays this error message on the form when the user sees the form for the second time. The employee can fill out the form again and re-submit it.