Tuesday, October 19, 2021

Sample Lesson: Reference Lookup Lists

What are Reference Lookup Lists?

Lookup lists are used to populate user interface elements like Lists, Combo box and Select boxes. When a list is made up of referenced objects, the list is called reference lookup list. Therefore, this list is implemented only in a reference relationship.

Example: Object A refers to object B. In this case, one can view all instances of object B while sitting on object A using a reference relationship.

 

Creating a Reference Lookup List

Step 1: Add the reference relationship

Make sure than an entry for the reference relationship has been made in the OBJECT_RELATIONSHIP metadata table.

For example: If the object Ticket refers to object Passenger, the relevant entry should be made in the OBJECT_RELATIONSHIP table.

 

Step 2: Make the relationship constrained

Reference relationship needs to be constrained to refer only to referenced objects that have the same parent as the referencing object.

For example: Ticket object should only refer to the passengers that have the same parent airlines as the ticket.

To make the relationship constrained, make appropriate entries in the following columns of the BUSINESS_VARIABLE metadata table:

Reference - Constraint Type: Constrained

Reference - Constraint Object Type: The parent object based on which the relationship is constrained. The parent object must be common to both the referenced and referring object. In this case, the parent is Airlines.

Reference - Constraint Path: The path to the parent object that constrains this relationship. The path must begin from the referencing object type. In this case, the path must begin from ticket and end with Airlines.

 


 

 Step 3: Add a label rule

How can the reference objects be displayed as a list? A label rule is used to provide a label to an object instance. Without a label rule, your referenced objects will not be visible in the list. In this case, the Ticket holder field on the UI that displays the passenger objects will appear as shown below without the label rule.



 The label rule for an object is provided in the OBJECT_TYPE metadata table.

·         Locate the entry for Object in the OBJECT_TYPE metadata table. In this case, the object is Passenger.

·         Provide the label rule in the Label Rule column.

Given below is screenshot that shows a very simple label rule. This label rule is used to display the passenger's first name.


Note that Passenger is a type of Person. Hence, we are using the attribute of the object Person. Also, note that the result type is String because the rule returns a label.

The reference list lookup for the passenger object looks like this after applying the label rule.



 Step 4: Display the Reference Lookup List

Whenever a reference relationship is defined in the OBJECT_RELATIONSHIP metadata table, Dragon automatically creates a Business Variable of type xReference to hold the referenced object. This is variable that should be used for the reference lookup list.

To display the reference lookup list, make an entry in the metadata table PAGE_LAYOUT_CELL. The data type should be xReference and the Cell BV Path should point to the reference variable.

 


 

Sorting and Filtering Reference Lookup Lists

Sorting a Reference Lookup List

The Reference List - Sort BV column of the OBJECT_RELATIONSHIP business variable table is used to reference lookup list.

Given below is the sorted lookup list for the Passenger object.

Filtering a Reference Lookup List

A rule can be placed on the reference list to filter the list based on a given criteria. The object type for the rule will be the list object, i.e., the object mentioned in the Related Object column of the OBJECT_RELATIONSHIP metadata table.

The rule to filter objects should be written in the Reference - Constraint Rule column of the OBJECT_RELATIONSHIP metadata table.


 

The above rule displays only passenger objects where the attribute Person Name First is not null. Without the rule, the passenger list would appear as given below:



Troubleshooting Reference Lookup Lists

 

Reference Lookup does not contain values

Possible reasons:

·         The reference relationship is not constrained.

·         There are no objects created of the referenced object type.

·         No label rule has been defined for the referenced object.

 

Reference Lookup displays object IDs

Possible reasons:

·         There is no label rule for the referenced object.

·         Label rule uses business variables that contain no values.

 

 

 

 

No comments:

Post a Comment