Dependencies

In Intrexx, data records are listed in the following view elements: 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 drop-down 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 drop-down 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 with the help of subordinate data groups, without resorting to programming.



In our example, when creating a new product in the Product data group, a product category should be selectable from a drop-down list. The second drop-down list, Sub Product Group, should only show the product subcategories there that are contained in the selected product's subcategory.



For this, a drop-down list called Product Group will be added to the Product edit page (in addition to the edit fields for the product data) that lists all product categories from the Product Group data group. A second drop-down list with the title Sub Product Group that draws its entries from the Sub Product Group data group.



The required settings will be selected on the properties dialog of the dependent drop-down list Sub Product Group, on the Dependencies tab.



The setting Initially show list without entries will load the drop-down list without entries when the page is loaded. 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 drop-down 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 event. 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 Group control here. In the second list, select the event that should be executed when the drop-down list is refreshed.

The events that may be selected depend on the type of control to be executed. This allows for a drop-down list, for example, to use the event onchange, which occurs as soon as the current entry in a drop-down 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 on Add new filter expressionhere or create a filter by double-clicking on the Filter area.



Further information regarding filters in Intrexx can be found here.

Next, select the Data field whose 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 Group 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 Group, 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, makes a comparison with the shown character string in the control that is initiated.

When comparing multiple data fields, you can specify 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 in the 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 started 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 on OK to complete the definition of the filter.



When loading a page in the browser, the entries in a drop-down 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 on OK.



Click on OK to complete the configuration of the dependent drop-down list. In the initiated control, in our example the drop-down list Product Group, 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 drop-down list. In the script editor, no script will be shown there.

Data group without relationship

A dependent drop-down 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 Group 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 drop-down list Storage Location will additionally be created.



For the Product Group drop-down 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 drop-down list Product Group after the comparison with the storage location.



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

Dynamic filter - Operator

The dynamic filter Operator can be set up in such a way that values from a subordinate data group may be searched through. 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 appears in the subordinate data group.

If you want to test, for example, which product subcategories appear 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 Sub Product Group.



The dependency will be entered to the table as follows:



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



The ID of the product group 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 drop-down 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 drop-down list bpm, the dependent drop-down 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 drop-down list that takes its entries from the reference of the data group bpm. On the bpm – Loops edit page, the users can now search for loops in a specific tempo.



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



Here the drop-down 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 to 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 drop-down 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 dependency, new dependencies can be defined and then assigned to the control to be filtered.