In this article

How to: Filter Data on a Screen

05/31/2012

3 minutes to read

In this article

You can filter the data that appears in List and Details, Editable Grid, and Search Data screens. For example, you could filter so that only customers who are located in the United States are displayed. To filter data, modify the query of a collection on a screen, or write a custom query and then use it to create a screen.

Modifying the Query of a Screen

List and Details, Editable Grid, and Search Data screens contain collections that are based on queries. For example, a collection that is based on the Customer entity uses this query by default: Select * from Customers. You can customize the conditions of the query. Your changes apply only to the collection on the screen and do not affect the query globally.

To modify the query of a screen collection

On the Screen Members List, next to the collection you want to modify, click Edit Query.

To create a screen by using a query in the solution

Create a screen. In the Add New Screen dialog box, for the Screen Data field, select a query. For more information about how to create a screen, see How to: Create a Screen.

Only data that meets the conditions that are defined by the query will appear in the screen.

To create a screen by using a query that accepts a parameter

Create a screen. In the Add New Screen dialog box, for the Screen Data field, select a query that accepts a parameter. For more information about how to create a screen, see How to: Create a Screen.

Because the query requires a parameter value, the new screen does not appear in the navigation menu of the running application. The screen is displayed when a user provides a value in a field in another screen. You must add that field to the other screen.

In the Screen Designer, in the other screen, click Add Data Item.

In the Add Screen Item dialog box, select Local Property. In the Type list, select a type for the local property.

In the Name box, provide a name for the local property, for example, CityName, and then click OK.

From the Screen Members List, drag the new local property to the Screen Content Tree.

In the Screen Content Tree, right-click the local property and then click Add Button.

In the Add Button dialog box, select New Method and then click OK.

In the Screen Content Tree, right-click the button and then click Edit Execute Code.

In the Code Editor, write code that displays the parameterized query screen. The following example displays the ShowCustomerByCity screen by passing the value of the local property named CityName.