|
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
Note: This is an unedited contribution. If this article is inappropriate,
needs attention or copies someone else's work without reference then please
Report This Article
IntroductionLogic Inspector in InfoPath 2007 Forms
To design and manage effective business solutions, Office InfoPath Form services offer you rich, dynamic forms that facilitate your team to gather, share and reuse information within a network. A form is simply a container that holds all the elements and controls that accepts user input and is saved in a local or server location. These forms can be sent as an email or viewed on the browsers so that the organization-wide collaboration and decision-making gets improved in less time. While designing forms, developers have a great task of maintaining integrity in data what the forms are intend to collect from the users. Office InfoPath 2007 has carefully taken this issue upfront and come up with tools to create and maintain integrity checks within the forms. Integrity made simple
Forcing the user to input valid data is surely a responsibility of the developer. When the user is allowed to input data in a form element, as a developer, all worries you have in your mind is how to ensure the correctness of data. InfoPath lets you provide three ways of ensuring the accuracy of user input, and they are: Default values, Validations and Rules. Default values are just simple way of telling the user what to enter in a form element. The developer himself supplies the initial value so that the user is properly guided to enter his own value. Validations are effective way of controlling the user input, with some logic. Providing validations ensure the correctness of data in the business context. . For instance, when the user is filling details in a Travel Request Form, input to the Request Date box is not just a date in correct format, but it should also meet certain conditions; Request Date should not be later than the Departure Date. Validation checks also allow you to specify the action that should takes place when the data is invalid. Rules imply a set of business conditions that are broader and significant in scope at application level. These rules comprise a stripe of logic between the elements and controls in a form. You can use rules to display messages, set values and apply other actions based on conditions in the form. Any number of rules can be defined for a single element and are applied in the order specified. Here is a sample InfoPath form for filling Travel Request details. In the design mode, it appears as shown below:
Figure 1: A sample InfoPath Form In the properties dialog of any control, you can specify default values, validations and rules.
Figure 2: Properties dialog of a form element As you see in the Figure 2, today() has been set as default value for requestDate field. To enter a default value, click on the fx button on the right side. In the Formula box, you can enter a value, insert a field or group or insert a function. Then, click on the OK button. See Figure 3.
Figure 3: Specifying a default value To provide a validation check to a control, click on the Data Validation button in the dialog as shown in Figure 2. In the Data validation dialog, you specify a condition, a tool tip string that appears when the user hovers with his mouse on the control and the message to display when the use inputs invalid data. Figure 4 shows how to define a validation condition for requestDate field.
Figure 4: Defining a validation check for requestDate field To define a rule, in the properties dialog (Figure 2) of the departureDate field, click on the Rules… button. On adding a new rule, Rule dialog appears as shown in Figure 5. Specify the name of the rule and click on the Set Condition button to specify a condition on which this rule might apply.
Figure 5: Defining a rule for departureDate field Next, you add actions that need to be performed when the rule is implemented.
Figure 6: Defining an action for departureDate field Actions are found in the drop-down list as shown in the Figure 7. Figure 7: List of Actions How to use Logic Inspector?
Logic Inspector is a new feature in InfoPath 2007 and is available in tools menu. Having defined default values, validations and rules in your form, the next thing you do is to use the Logic Inspector to examine relationships and dependencies that exist with in a form. This would be a more organized and systematic approach to forms development. Logic Inspector displays all kinds of integrity constraints you define in a form in the tree structure. Data validation, Calculated Default values, Rules and any programming script that controls the user input are the root nodes and collapsing each one of them gives you the relevant details. Figure 8 shows the Logic Inspector results for the Travel Request Form we discussed earlier in this article.
Figure 8: Logic Inspector for Travel Request Form As you see in the figure, the Logic Inspector has two panels; one on the left listing all the integrity-check items. On clicking a particular field, panel on the right appears. From the information on the right panel, you could understand how fields are inter-related and dependent on each other. The relationship details are classified in to three categories. 1. Logic that depends on the value in this field or group When you click on the departureDate field in the right panel, all dependencies of this field (Validations, Default values and Rules) with respect to other fields are shown as in Figure 8. Dependencies with no participation from other fields are not listed. Please note that the Calculated Default values node has “None” entry. Since the returnDate depends on the value in the departureDate field, it is listed in Validation and Rules node.
Figure 9: Logic Inspector displaying fields involved in Dependency 2. Logic that is triggered by a change in this field or group Whenever there is a change in the value of the departureDate field, not only the validation and rule specified for the field is applied but also checks the value of requestDate field. The validation and rules defined for requestDate field is also triggered. This relationship is displayed as shown in the Figure 9.
Figure 10: Logic Inspector displaying fields involved in Triggering effect 3. Logic that may change this field or group. This category of information displays the values assigned to a field changes the value of the field, with no user interaction. In the Figure 10, you can see the default values that change the value of the returnDate field.
Figure 11: Default values for a field Conclusion
When you develop complex forms, you might often get into much more complex interlacing of data relationships and field dependencies. With Logic Inspector, you can provide an assured support for data accuracy and integrity in your forms.
|
|||||||||||||||||||||||||||||||||||