Thursday, September 6, 2012

Allow Query-by-Example

The application generator automatically configures all data controller fields for adaptive filtering. Only “blob” fields such as pictures and long text fields are excluded. Fields created manually will have filtering disabled. The Allow Query-by-Example property controls if adaptive filtering is allowed for a field.

Disable Filtering

Query-by-Example can be disabled to prevent filtering on a field.

Start the Project Designer. In the Project Explorer, double-click on Products / Fields / ProductName node.

ProductName field of the Products controller in Code On Time web application generator's Project Explorer.

Disable Allow Query-by-Example.

Property New Value
Allow Query-by-Example false

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

Navigate to the Products page. Click on the Product Name header. No filtering options will be available.

Product Name column with filtering options disabled.

The Product Name field will not be available for search in the advanced search bar.

Product Name not available for filtering in the advanced search bar.

Enable Filtering on Large Text Fields

Large text fields do not have filtering enabled because most search operations would not work, such as auto-complete, sampling, and multiple values. For Microsoft SQL Server, the only available search options are “contains” and “does not contain”.

Let’s enable filtering for the Description field in the Categories controller.

In the Project Explorer, double-click on Categories / Fields / Description node.

Description field in the Categories controller in the Project Explorer.

Enable Query-by-Example.

Property New Value
Allow Query-by-Example true

Press OK to save the field.

In the Project Explorer, double-click on Categories / Views / grid1 / Description data field node.

Description data field in grid1 view of Categories controller.

Change the Search Options property.

Property New Value
Search Options $disablesamples, $disablemultiplevalues, $disableautocomplete, $contains, $doesnotcontain

Press OK to save the data field. On the toolbar, press Browse.

Navigate to the Categories page. Activate the dropdown in the Description column header. Two text filters are now available – contains and does not contain.

Description column header filtering options only display 'contains' and 'does not contain'.

The filters will also be available on the advanced search bar.

Description field filter options in the advanced search bar are limited to 'contains' and 'does not contain'.

No comments:

You can find more about Code OnTime Generator, Data Aquarium Framework, and other great products here.


© 2010 Code OnTime LLC. Intelligent code generation software for ASP.NET. Visit us at http://codeontime.com