How to create a navigation rule
Contents
Introduction
This document describes how to create a navigation rule.
The navigation model is explained deeply in the following document: Navigation Model Documentation
Rules definition at field level
These rules are defined in the Navigation Rules tab of the Windows, Tabs and Fields window, below the Field tab.
System administrator can add rules to a field in order to make it navigate to a custom tab.
Main fields that have to be set are:
- Sequence Number
- Priority of the rule. The rules are applied in ascending order.
- Tab
- Destination tab that will be opened if the rule is met.
- Direct Navigation
- Flag that determines whether the HQL Logic clause is executed or if the rule is always applied.
- HQL Logic
- HQL where clause that the record being opened has to meet in order to open the specified tab of the rule.
Rules definition at table level
The rules at table level for the Extended Navigation Model are defined in a new tab of the Tables and Columns window called Navigation Rules
System administrator can add new rules to a table in order to make the links which have that table as a reference navigate to a custom tab.
The rules are defined following the same logic than Field Level Rules.
Creating Rules
To create a rule that it is not of Direct Navigation you have to define the HQL Logic field with a where clause expression. This expression is appended to a HQL that it is executed on the table where the record that it is being opened is stored. The HQL is also filtered by the id of the record so it can only return that record. If the HQL returns the record then the rule is valid and it is opened on its tab. If no results are returned it is executed the next rule.
The HQL Logic has to be a valid HQL where clause. The alias of the main table is e, using it it is possible to access the properties of that table.
For example the C_OrderLine table has different Order types that are managed on different windows. Sales orders that are not return orders have to be opened in the Sales Order window. It is needed to create a rule with an HQL Logic that returns the order line only in case it is a Sales Order and it is not a Return. The HQL Logic looks like:
e.salesOrder.salesTransaction=true AND e.salesOrder.documentType.return=false
You can check in the Application Dictionary how this rule is created and how there are other rules for purchase and/or return orders.