Filter the data that is displayed in a control InfoPath 2007

Author: mety Labels::



When you design a Microsoft Office InfoPath form template, you can use filters to limit the choices that users can make when they fill out a form that is based on that form template. A filter is a set of conditions that is applied to data to display a subset of that data. You can use filters to display a subset of the data from a data source (data source: The collection of fields and groups that define and store the data for an InfoPath form. Controls in the form are bound to the fields and groups in the data source.), which reduces the number of records that are displayed in a control.
Use a filter whenever you need to display a subset of the data that is returned by a query that is based on criteria selected by a user. That criteria can be an item that is selected in another control (such as a list box, combo box, drop-down list box, or text box) that is bound (bind: To connect a control to a field or group in the data source so that data entered into the control is saved. When a control is unbound, it is not connected to a field or group, and so data entered into the control will not be saved.) to a field in the data source.
For example, imagine that you are creating a form template that will be used to track the products from several suppliers. If you display all the products from all your suppliers, the list can be very long. To solve this problem, you can use a filter that enables your users to select a supplier from the list and view only that supplier's products. When a user selects a supplier from the list box, a filter is applied to the repeating table to show only the products from the selected supplier. If the user selects another supplier, the repeating table is updated with the products from the other supplier.
Tip If you know that your users will require a consistent subset of a query result, modify your query to return only this subset instead of using a query to retrieve all the data and then applying a filter to create a subset. Your users will experience faster form load times and spend less time waiting for query results because the query returns only the data from the external source that you need.
To show your users that a filter is applied to data, the filter icon Filter iconappears when the user moves the mouse pointer over the filtered data.
Because filters limit the number of items that are displayed to a user, they can be applied only to the following types of controls:
  • List boxes
  • Drop-down list boxes
  • Combo boxes
  • Repeating tables
  • Repeating sections

Compatibility considerations

Filters can be used only in form templates that are designed to be filled out in InfoPath. Filters are not available in browser-compatible form templates (browser-compatible form template: A form template that is designed in InfoPath by using a specific compatibility mode. A browser-compatible form template can be browser-enabled when it is published to a server running InfoPath Forms Services.). If you are using a list box and a repeating table in a browser-compatible form template, consider using conditional formatting instead of filters. Find links to more information about how to use conditional formatting in the See also section.

Set a filter for a list box, drop-down list box, or combo box

Set a filter for a list box, drop-down list box, or combo box

  1. Right-click the control that you want to modify, and then click Control Properties on the shortcut menu.
  2. Click the Data tab..
  3. Do one of the following:
    • To use the values from a data source, click Look up values in the form's data source.
    • To use the values from a data connection, click Look up values from an external data source and then, in the Data Source list, click the data connection that you want to use.
  4. Click Select XPath Button image next to the Entries box.
  5. In the Select a Field or Group dialog box, click the field or group that contains the fields that provide the values for the control, and then click Filter Data.
  6. In the Filter Data dialog box, click Add.
    Note If you want to add a condition to an existing filter, click the filter that you want, and then click Modify.
  7. In the first box in the Specify Filter Conditions dialog box, click the name of the field whose data you want to filter.
  8. In the second box, click the type of filter that you want to use.
  9. In the third box, click the type of condition that you want to apply to the filter, and then type the condition.
  10. To configure more than one condition for the filter, click And, and then do one of the following:
    • To apply the existing condition and the new condition to your filter, click and, and then add your new condition.
    • To apply either the existing condition or the new condition to your filter, click or, and then add the additional condition.
  11. Click OK to close the dialog boxes.
  12. To test your changes, click Preview on the Standard toolbar, or press CTRL+SHIFT+B. The form template opens in a new window.
  13. In the preview window, select different values in the filter control to test that it is working correctly. If the values in the control that contains a filter are not correct, either because there are too many values or not enough values, try the following:
    • If you are using multiple conditions in your filter, remove all but one condition in order to check that the correct values are returned from that single condition. If the first condition returns the correct values, then add another condition, and test it.
    • Filters make a distinction between uppercase and lowercase characters. If you want to display data that begins with an uppercase or lowercase character, create a filter with an uppercase letter condition, select or in the Specify Filter Condition dialog box, and then create a lowercase letter condition.
    • If the filtered values are exactly opposite of what you expect, for example the products from all of the suppliers display instead of the products from a single supplier, change the filter type in the condition. For example, if your condition uses the filter type is equal to and you are getting too many products, try using the filter type is not equal to.

Set a filter for a repeating section or repeating table

To configure a filter in a repeating section or repeating table, you need to include a section or table in your form template that meets the following requirements:
  • The repeating section or table is bound to a repeating field or group.
  • The repeating section or table contains at least one control that is bound to a field that has a data connection.
For example, you can use a text box control in a repeating section to display the data in a field.

Set a filter for a repeating section or repeating table

  1. Right-click the Repeating Table or Repeating Section label that appears below the table or section on the form template, and then click Control Properties on the shortcut menu.
  2. Click the Display tab.
  3. Click Filter Data.
  4. In the Filter Data dialog box, click Add.
    Note To add a condition to an existing filter, click the filter that you want, and then click Modify.
  5. In the first box in the Specify Filter Conditions dialog box, click the name of the field whose data you want to filter.
  6. In the second box, click the type of filter that you want to use.
  7. In the third box, click the type of condition that you want to apply to the filter, and then type the condition.
  8. To configure more than one condition for the filter, click And, and then do one of the following:
    • To apply the existing condition and the new condition to your filter, click and, and then add your new condition.
    • To apply either the existing condition or the new condition to your filter, click or, and then add the additional condition.
  9. Click OK two times to close the open dialog boxes and return to the Control Properties dialog box.
  10. To display a special filter icon Filter icon to the user, which indicates that the data in the repeating section or repeating table has been filtered, click Show filter icon to indicate filtered items on the Display tab in the Control Properties dialog box.
  11. To test the filter and make sure that it is working correctly, click Preview on the Standard toolbar. The form template opens in a new window.
In the preview window, select different values in the filter control to test that it is working correctly.
If the values in the control that contains a filter are not correct, either because there are too many values or not enough values, try the following:
  • If you are using multiple conditions in your filter, remove all but one condition in order to check that the correct values are returned from that single condition. If the first condition returns the correct values, then add another condition, and test it.
  • Filters make a distinction between uppercase and lowercase characters. If you want to display data that begins with an uppercase or lowercase character, create a filter with an uppercase letter condition, select or in the Specify Filter Condition dialog box, and then create a lowercase letter condition.
  • If the filtered values are exactly opposite of what you expect, for example the products from all of the suppliers display instead of the products from a single supplier, change the filter type in the condition. For example, if your condition uses the filter type is equal to and you are getting too many products, try using the filter type is not equal to.

0 comments |

Labels

Blog Archive

Powered by Blogger.

I made these pages for me and my friends to help solving the problem we face regarding Computer & internet, if anyone wants me to answer a question or find out about some information please send me email and I will try to reply.*P.S. some of the article I wrote and the other I found on the internet I posted them in sprit of learning and shearing, please forgive me if you found something you don’t want to be in my blog, email me and I will delete them. Thank you for your interest in my pages.امل نجم Amal Nagm

banner 1 banner 2