Skip to content

Add a reference in the projection file

In this section a reference CustomerRef is added to the projection. It also describes how this reference is reflected in the client.

Refer to Figure 1 for the relation between the projection, client and the reference. The complete example code for the projection and client file is available at the end of this section.

Relation Projection-Client Reference

Figure 1 - Relation projection - client, with reference in the projection file.

A reference is a one-to-one relationship between two objects. For example, a reference from the entity CustomerOrder to the entity CustOrdCustomer is a relationship reference between these two entities.

To implement this in the projection, the entity CustomerOrder is made override, and then a reference CustomerRef to the entity CustOrdCustomer is added.

In the client file, a lov field is added using the reference CustomerRef, and the entity CustOrdCustomer can then be used to populate this lov field.

The lov field shows the relevant customer related to the specific customer order, and the user can select one of the customers for the order.

Adding the reference in the projection file

  1. In the projection file under the area ENTITY DETAILS, override the entity CustomerOrder.
  2. Add the reference CustomerRef to CustOrdCustomer, inside the entity CustomerOrder.
  3. Pass the key (CustomerNo) to the reference CustomerRef, and to the entity CustOrdCustomer that is referred.
  4. Deploy the projection file.

Adding a lov field in the client file

  1. In the client file under the area VISUAL COMPONENTS, create a field CustomerRef inside the group CustOrdMainGroup. a. The field automatically becomes a lov field when added. b. The Aurena framework automatically generates an entityset to be used by the lov field, which is an entityset based on the entity CustOrdCustomer. c. The entityset populates the lov field. d. The Aurena framework generates a default selector for the lov field.
  2. Add a label with the text "Customer No" to the lov field. a. If no label is added to the lov field, the name otherwise becomes "CustomerRef".
  3. Deploy the client file.
  4. Go to the test site for the EAPDemo: https://cmbpde/CustOrdDetails.1762.corpnet.ifsworld.com:58080/main/ifsapplications/web/page/EAPDemo

In the client page the field Customer No has a dropdown menu that populates a lov field. In the lov field there is also the functionality to type in and filter the values. There are some other functionality available as well, such as the most recently or frequently used records.

The lov field has a default selector with some fields, which is generated from the Aurena framework. It is possible to define a custom selector for the lov field which overrides the default selector and displays only the defined fields.

Adding a custom selector in the client file

This section describes how to create a custom selector, not generated from the Aurena framework. The custom selector has some defined fields, and an added lov field compared to what is automatically generated by the Aurena framwork.

  1. In the client file under the area VISUAL COMPONENTS, create the selector CustomerSelector, and refer it to the entity CustOrdCustomer.
  2. Add fields to the selector, as shown in the example code.
  3. In the group CustOrdMainGroup, add an lov field CustomerRef and refer it to the selector CustomerSelector.
  4. Add a label for the lov field CustomerRef with the text "Customer No 1".
  5. Deploy the client file.
  6. Go to the test site for CustOrdDetails: https://cmbpde1762.corpnet.ifsworld.com:58080/main/ifsapplications/web/page/EAPDemo/CustOrdDetails.

The lov field CustomerRef with the label "Customer No 1" is now available in the client, and the selector CustomerSelector has the defined fields.

Final result - reference

Figure 2 - Final result in client

(A) - Selector

This is the record selector CustOrdSelector which is populated with values from the entityset CustomerOrders. When different records are selected in the record selector, they are reflected in the group CustOrdMainGroup.

(B) - Custom selector

This is the selector CustomerSelector with the defined fields inside the lov field CustomerRef.

(C) - Custom LOV

This is the lov field CustomerRef using the reference CustomerRef, and the entity CustOrdCustomer to populate it.


projection EAPDemo;  
component FNDBAS;  
layer Core;  
description "Example of creating a projection";  
category Users;  

------------------------- MAIN ENTRY POINTS --------------------------  
//Dynamic dependency  
@DynamicComponentDependency ORDER  
entityset CustomerOrders for CustomerOrder;  


------------------------ ENTITY DETAILS ------------------------------  
//Added reference  
@Override  
entity CustomerOrder {  
    reference CustomerRef(CustomerNo) to CustOrdCustomer(CustomerNo);  
}  

Example code - Projection file (reference example).


client EAPDemo;  
component FNDBAS;  
layer Core;  

------------------------- MAIN PAGES --------------------------  
navigator {  
    entry EAPDemo toplevel at index 10 {  
        label = "EAP Demo Pages";  
        entry CustOrdOverview;  
        entry CustOrdDetails;  
    }  

    entry CustOrdOverview {  
        label = "Customer Orders";  
        @DynamicComponentDependency ORDER  
        page CustOrdOverview;  
    }  

    entry CustOrdDetails {  
        label "Customer Order Details";  
        @DynamicComponentDependency ORDER  
        page CustOrdDetails;  
    }  
}  

page CustOrdOverview using CustomerOrders {  
    label = "Customer Orders";  
    list CustOrdList;  
}  

page CustOrdDetails using CustomerOrders {  
    label = "Order Details ${OrderNo}";  
    selector CustOrdSelector;  
    group CustOrdMainGroup bind CustOrdSelector;  
}  

------------------------- COMMANDS ----------------------------  

------------------------- VISUAL COMPONENTS -------------------  
selector CustOrdSelector for CustomerOrder {  
    label = "Order - ${OrderNo}";  
    field OrderNo;  
    field CustomerNo;  
    field WantedDeliveryDate;  
    field PrepaymentApproved;  
    field Objstate;  
}  

//Custom selector for the reference example  
selector CustomerSelector for CustOrdCustomer {  
    field CustomerNo;  
    field MarketCode;  
    field EdiAuthorizeCode;  
    field Name;  
    field TemplateCustomer;  
}  

group CustOrdMainGroup for CustomerOrder {  
    label = "Basic Info";  
    field OrderNo;  
    field WantedDeliveryDate;  
    field PrepaymentApproved;  
    //Added for the reference example  
    field CustomerRef {  
        label = "Customer No";  
    }  
    //Added for the custom selector in the reference example  
    lov CustomerRef with CustomerSelector {  
        label = "Customer No 1";  
    }  
    field StagedBilling;  
    field Objstate;  
    field PrintDeliveredLines;  
    field NoteId;  
    field PreAccountingId;  
}  

list CustOrdList for CustomerOrder {  
    field OrderNo;  
    field WantedDeliveryDate;  
    field PrepaymentApproved;  
    field StagedBilling;  
    field PrintDeliveredLines;  
    field NoteId;  
    field ObjState;  
    field PreAccountingId;  
}  

Example code - Client file (reference example).