JavaScript is disabled on your browser.

Dependencies

In the following view elements in Intrexx, data records will be listed: These elements can be filtered with a dependency to other controls. All controls, including the various application pages that are JavaScript capable, can be called up as triggering controls for a dependency. This allows, for example, a selection list to be configured in such a way that its entries will be filtered as soon as an event occurs in another control that triggers it. The dependent selection list will then show only, for example, the hotels that can be found in the currently selected city, or only the products in the selected product category.

Subordinate Data Group

Data with a parent-child relationship, such as product categories and product subcategories, can be shown in Intrexx without resorting to programming with the help of subordinate data groups.



In our example, when creating a new product in the Product data group, a product category should be able to be chosen from a selection list. The second selection list, Product Subcategory, should show only the product subcategories there that are contained in the selected product category.



For this, on the Product edit page, in addition to the edit fields for the product data, a selection list called Product Category will be created that lists all product categories from the Product Category data group. A second selection list with the title Product Sub Group draws its entries from the Product Sub Group data group.



The required settings will be selected on the properties dialog of the dependent selection list Product Subcategory, on the Dependencies tab.



The setting to Show list without entries initially will load the selection list without entries upon loading the page. With Add Dependency, a new dependency will be defined. If dependencies have already been defined for the current page, they may be selected for the selection list, as long as the data group of the filter corresponds to the source data group of the control. With this, the selected dependency will be active. By clicking Remove Dependency, existing dependencies can be deleted. They will also no longer be available to other controls. The properties of existing dependencies can be changed by clicking on Edit Dependency .



First, enter an appropriate Title and then the control to be executed. To do so, click on Add Dependency. The events of the control to be run can also be defined by double clicking on the field.



In the Control list, all controls on the current page for which JavaScript can be defined, including the page itself, can be selected. Select the Product Category control here. In the second list, select the event that should be executed when the selection list is refreshed.

The events that may be selected depend on the type of control to be executed. This allows for a selection list, for example, to use the event onchange, which occurs as soon as the current entry in a selection list changes. For a button, for example, the onclick event can be selected, which occurs when a user clicks the button. All control-specific events are available to you that can also be used in Intrexx with JavaScript.

Save the setting with OK.



In the Filter area, the filter will now be defined that will be run when a product category is chosen from the selection list Product Subcategory. Click Add here or create a filter by double clicking on the Filter area.



General informations on filters in Intrexx you can find here.

Next, select the Data Field from which the value will be compared with the value in the control to be executed. For our example, the value of the FKLID data field will be compared with the Saved Value of the Product Category control.



In the database table, the primary key, the LID of a product category, will be automatically saved by Intrexx to the subordinate data group in the FKLID field, if a new product subcategory is created. The parent-child relationship of the data will therefore be automatically taken care of, as soon as a new subordinate data group is created in an Intrexx application.

With the filter FKLID = Control Product Category, only the product subcategories will be shown that have the same value in the FKLID field as the selected product category has in the field LID.

In this case, then, the Saved Value / Primary Key setting is obligatory. This setting compares the value of the data field automatically with the LID of the data record. The setting Displayed Value, on the other hand, compares with the shown character string in the control that is initiated.

When comparing multiple data fields, it can be input whether all or at least one data field must fulfill the filter expression. The interval option is available if the dynamic filters Value Range or Calendar are used for comparison.

For example, if you are filtering tasks, a starting date of December 1 and an ending date of December 5 is entered, the setting Interpret as Interval will return all tasks that started before the first of December and were completed within the defined time frame, as well as all tasks that were begun in the defined time frame and finished after the fifth of December.

For a comparison with the filter control Boolean Values, the Mode can be defined for the effect that marking the checkbox in the browser should have. The following settings are possible: Click OK, to complete the definition of the filter.



When loading a page in the browser, the entries in a selection list, for which dependencies have been defined, will be shown unfiltered. If you use the onload event of the page as an initiating event, the filter will already be set when the page is loaded.

Click OK.



Click OK, in order to complete the configuration of the dependent selection list. In the initiated control, in our example the selection list Product Category, a script will be automatically entered for the onchange event. This entry documents the assignment of the event. The title will be created from the term Dependency and the name of the dependent selection list. In the script editor, no script will be shown there.

Data group without Relationship

A dependent selection list can also be filtered using a comparison with the shown character string in the control to be executed, if data groups do not have a relation with each other via a key.

Let us assume that when selecting a storage location, only the product categories will be shown that have been stored at this location. In our sample application, the storage location will be saved in the data group Product Category and in the data field Storage Location.



In the Storage Location data group, on the other hand, all existing storage locations will be saved. The data group Storage Location must not necessarily be found in the same application for this. On the edit page Product, the selection list Storage Location will additionally be created.



For the Product Category selection list, ,the control Storage Location will be entered with the event onchange in the properties dialog on the Dependencies tab.



The filter shown below restricts the entries in the selection list Product Category after the comparison with the storage location.



With these settings, in the Product Category selection list only the categories will be shown that have been assigned to the selected storage location in the selection list Storage Location.

Dynamic Filter Type Operator

The dynamic filter Operator can be set up in such a way that values from a subordinate data group may be searched. When filtering, the data records found in the subordinate data group will not be shown, but rather the records from the superior data group in which the value occurs in the subordinate data group.

If you want to test, for example, which product subcategories occur in product categories, you can construct a filter of this type for the product groups table (in our example, on the main page of the application).



The filter will be set for the data group Product subcategory.



The dependency will be entered to the table as follows:



The operator of the filter will be entered as executing control. The filter will be configured as follows.



The ID of the product category will be selected as Data field to be filtered. This ID is entered to the product subcategory into the field FKLID as soon as a new product subcategory is created. For the Comparison value, select the Operator field in which the search term is entered by the user. Now the field FKLID can be selected as comparison field. Here you will see the result in the browser.

References



Dependent selection lists can also be implemented for data from references. In this example, music loops in various tempos will be managed in an application. When the user selects a tempo from the selection list bpm, the dependent selection list, which contains all titles, should only show the loops that play in the chosen tempo.

In the bpm data group, all tempos will be saved in an integer data field. The Loops data group references the data group bpm. The titles of all loops and the corresponding tempo will be saved here.



The tempo will be chosen here from a selection list that takes its entries from the reference of the data group bpm. On the bpm – Loops edit page, one may now search for loops in a specific tempo.



The required settings will be set in the properties dialog, on the Dependencies tab, for the selection list Loops.



Here the selection list bpm will be set as initiating control. The filter should be assigned the event onchange. The filter can be set in this case for two different types.

First, the primary key of the reference can be compared the the saved value of the control.



Second, the value of the reference data field bpm can be compared with the displayed value in the bpm selection list.

Page Properties – Dependencies Tab



In the properties of pages, you will be able to find the Dependencies tab. All dependencies that are defined for the current page will be listed here. By clicking Add, new dependencies can be defined and then assigned to the control to be filtered.