Data Controllers / Fields / Context Field

  Static Lookup Filter Values

Table of Contents
Data Controllers / Fields / Context FieldPrint||
Static Lookup Filter Values

Property Context Fields can list static values that can be used as lookup field filters.

For example, the CategoryID lookup field on the Products edit form displays eight categories available for selection.

CategoryID lookup window displays all categories by default.

Let’s specify static filter values for the CategoryID lookup data view.

Start the Project Designer. In the Project Explorer, switch to Controllers tab. Double-click on Products / Fields / CategoryID field node.

CategoryID field of Products controller.

Change the Context Fields property:

Property New Value
Context Fields CategoryID=1, CategoryID=5

Press OK to save the field.

CategoryID refers to the primary key of Categories controller. Any other data field in grid1 can be referenced as well.

CategoryID field of Categories controller.

On the toolbar, press Browse.

Navigate to the Products page, and edit a record. Activate the CategoryID lookup – only two items will be displayed.

CategoryID lookup window only displays two options.

If the lookup filter fields are text based, then the value must be surrounded by single quotes. For example, let’s use the field CategoryName as a context filter.

CategoryName field on grid1 view of Categories controller.

Change the Context Fields property of Products / Fields / CategoryID as shown next:

Property New Value
Context Fields CategoryName='Seafood', CategoryName='Dairy Products'

Press OK to save the field. On the toolbar, select Browse.

Navigate to Products page, and edit a record. Activate the CategoryID lookup – only two categories will be available for selection. Notice that the CategoryName field is hidden, since it is explicitly defined in the grid view.

CategoryID field displaying two options.