Dependent Comboboxes in Time Cockpit Forms and Lists

Sunday, October 19, 2014 by Rainer Stropek

Comboboxes that depend on each other are a common requirement in time cockpit. Example: Once a customer is selected, the project combobox should only contain the selected customer's projects. Configuring dependent comboboxes isn't complex. This blog article describes how you can do it in custom forms and lists.

BoundCell vs. RelationCell

If you generate a form in time cockpit, each property and each relation becomes a BoundCell. This cell type lets time cockpit decide which control to use based on the bound model entity. If you bind the cell to a date field, a date picker will appear. If you bind it to a text field, a textbox will appear and its size will depend on the text field's maximum length. If you bind the cell to a relation between to entities, a combobox will appear and you can use it to select the related entity.

The following example shows two BoundCell elements in a filter form. Note that FilterPath reference relations in both cases. Because of that, the filter form will display two comboboxes (one with customers and one with projects).

Here is another example from time cockpit's Timesheet form. It will show a combobox with all means of transport:

BoundCell makes it super-easy to implement the typical case. However, if you want to configure details like dependent comboboxes you have to change the cell type to RelationCell. Internally, BoundCell becomes a RelationCell automatically if you bind it to a relation.

So your first step for creating dependent comboboxes is to change BoundCell into RelationCell for that combobox that depends on another field in your form.


Dependent combobox are filtered based on other inputs in the same form. An example are the comboboxes Project and Task in time cockpit's Timesheet form. Every project has 0..n tasks, every task can be assigned to a project. Therefore it makes sense to filter the available tasks to only those tasks that are assigned to the selected project. The combobox with tasks will be empty as long as the user hasn't selected a project:

The combobox will contain a filtered list of tasks when the user has selected a project:

If you add a RelationCell to a form, time cockpit will show all records that the current user has access to. To filter the combobox as shown above, the RelationCell supports a property called Condition. It allows you to specify a TCQL condition that should be added to the query when looking for the records displayed in the combobox. Lets walk this through using an example: The following TCQL query will return all tasks:

If we want to display only the tasks for project Adventure.Recruiting Training, the TCQL query would have to be extended with a WHERE clause (note: {c6976761-6904-...} is the internal ID of the project):

The Condition property of the RelationCell allows us to specify exactly that filter. The following screenshot analyzes time cockpit's definition of the Project and Task RelationCell elements in the Timesheet form (click to enlarge):

Note that you need not reference other fields in the Condition. You can also specify constant filters like shown in the Project combobox above (only displays projects that are not closed).


Beside Condition, RelationCell has a second property related to dependent comboboxes: LookupCondition. It controls the condition that is applied when the user clicks on the Open list with details button:

In most cases, LookupCondition will be set to the same value as Condition so that both lists contain the same content. However, you might want to display a less restricted list if the user clicks on Open list with details. In this case specify a different expression in LookupCondition or skip it entirely to display all records without filtering.

Conditions in Filter Forms

Generally, combobox conditions in filter forms work just like conditions in other forms. However, there is one important difference: You have to give the source combobox a FilterParameterName so that you can reference its value in the condition expression. The following screenshot shows how this is done (click to enlarge):

Having Problems - Contact us

Having problems with defining your forms and lists? Too technical for you? Contact us to get support or let our professional services team assist you in tailoring time cockpit to your specific needs.

comments powered by Disqus