Choosing the data source for a list view

List views use different kinds of data sources to support different application requirements. The simplest data source is an array field on an entity type. An array field generally has a limited set of items that do not require a database query to retrieve. For example, the list of exposures for a claim is relatively short and is retrieved from the database as part of the overall claim, without a separate database query.

Other data sources for a list view involve a query and are more complex. This is especially true for search results or lists of items (activities, claims, and so on) on the Desktop. For example, a query as the source for a list view could be “all activities assigned to the current user that are due today or earlier.”

You specify the data source for a list view with the value property of the row iterator for the list view.

Source

Description

Array field

An array field on an entity type is identified in the Data Dictionary as an array key. For example, the Officials field on a Claim is an array key. Thus, you can define a list view based on Claim.Officials. In this case, each official listed on a specified claim is shown on a new row in the list view. You can also define your own custom Gosu methods that return array data for use in a list view. The method must return either a Gosu array or a Java list (java.util.list).

Query processor field

A query processor field on an entity type is identified in the Data Dictionary as a derived property returning gw.api.database.IQueryBeanResult. It represents an internally-defined query, and usually provides a more convenient and efficient way to retrieve data. For example, the Claim.ViewableNotes field performs a database query to retrieve only the notes on a claim that the current user has permission to view. This is more efficient than using the Claim.Notes array field, which loads both viewable and non-viewable notes and filtering the non-viewable ones out later.

Finder method

A finder method on an entity type is similar to a query processor field, except that it is not defined as field in the Data Dictionary. Instead, a finder method is an internally-defined Java class that performs an efficient query on instances of an entity type. For example, the Activities page of the Desktop uses a list view based on the finder method Activity.finder.getActivityDesktopViewsAssignedToCurrentUser.

Query builder result

A query builder result uses the result of an SQL query. For more information, see Query builder APIs.

List views behave differently depending on whether the source is an array or one of the query-backed sources.

Behavior

Array-backed list view

Query-backed list view

Loading data

The full set of data is loaded upon initially rendering the list view.

Only the data on the first page shown is fetched and loaded.

Paging

The full set of data is reloaded each time you move to a different page within the list view.

The query is re-run. Data is loaded only for the page that is viewable.

Sorting

The full set of data is reloaded each time the list view is sorted.

The query is re-run and sorted in the database. Therefore, you can sort only on columns that exist in the physical database, and not (for example) on virtual columns. Data is loaded only for the page that is viewable.

Filtering

The full set of data is reloaded each time the list view is filtered.

The query is re-run and filtered in the database. Therefore, you can filter only on columns that exist in the physical database, and not (for example) on virtual columns. Data is loaded only for the page that is viewable.

Editing

Paging, sorting, and filtering work as noted above, as long as any modified (but uncommitted) data is valid. Sorting and filtering can result in modified rows being sorted to a different page or filtered out of the visible list.

Paging, sorting, and filtering are disabled.

Best suited for

Short lists

Long lists

Additional notes

Do not use a query-backed editable list view in a wizard.