二维码

[教程] CREATING TABLE VIEW FOR LINE ITEMS WITH DEPENDENT CONTEXT NODES

Twilight发表于 2015-12-05 01:12Twilight 最后回复于 2015-12-05 01:12 [复制链接] 2654 0

We know that every service contract can have multiple line items. In order to display those items, Let us create one table view in our component.

Go to the component and create one new view.  Give any suitable name to the view.
In the step, ADD MODEL node, we will create dependent nodes. First create one context node with BTAdminh as base entity.  This will context node will act as a parent context node. Next click on CREATE button as highlighted in the screen shot.
Higher-level 1.jpg

It will add one new row. Enter the context node name and choose BTItems as a base entity. We need this context node dependent on the HEADER context node. So click on the higher level model node. It will show ‘header’ context node. Choose it.
Higher-level 2.jpg

Then we need to specify the relation between the base entity of higher level context node to the base entity of dependent context node.  Click on BOL relation and choose the value.
Higher-level 3.jpg

We need to add one more model node, which will be dependent on ITEMSET node. Click on create and in the new row give context node name and choose BTAdminI as base entity. To make it dependent on ITEMSET context node chooses entries as shown below.
Higher-level 4.jpg

Here BTAdminI is dependent on BTItems and BTItems dependent on BTAdminH.  So if we are able to feed the data to BTAdminH. With help of relations, required data automatically flows to its child nodes. Just click on continue up to the step CREATE LINKS TO CUSTOM CONTROLLERS.

Here we bind the HEADER context node in our table view to the HEADER context node of the custom controller. So that data will automatically flow. Choose the entries as shown below.
Higher-level 5.jpg

In the step ‘SELECT VIEW TYPE’, choose the view type as table type. Here we need to specify which context node will act as a base for our table view. As we want to show line item details, specify the last context node and choose the option configurable check box. Complete the wizard.
Higher-level 6.jpg

Why we have created three context nodes ?

The answer lies in the design we chose and the model on which we are working.
First we have created BTAdminH (header context node).  We need to feed data first to this one because it’s independent node in our hierarchy.  For this we have done the binding from this context node to the context node of custom controller while creating view itself. So feeding data to the top node is done.

When we create dependent nodes with relations, framework will automatically add code to one method called ON NEW FOCUS of context node classes.  See the below screen shot. This method will be used to fetch the data for dependent nodes based on the data from their corresponding parents.
Higher-level 7.jpg

Let us examine this .

Go to the context class *CTXT and find the method CREATE CONTEXT NODES.
Higher-level 8.jpg

Double click on it to see the code. This method will be used to create all three context nodes.
Higher-level 9.jpg

As per the code, first CREATE_HEADER method will be triggered. Double click on it to see the code.
Higher-level 10.jpg

We can see the method DO CONEXT NODE BINDING. As soon as header node is created then binding is done to the custom controller context node(This code is there because we bound it to the custom controller while creating view). So data will flow from the custom controller context node to this header context node. Data is feeding to the top node is done.

Next go back and double click on next method CREATE_ITEMSET.
Higher-level 12.jpg

Here, from 18 and to 21, they are reading record from header context node and at 25, they are calling the ON NEW FOCUS method of ITEM SET ( dependent of header ) by sending the record from the header context node.
Double click on NEW FOCUS to see the code.
Higher-level 11.jpg

Here you can see the relation that we have given while creating second context node. So data is read from the top node using the relation and feeding it to the context node collection.So data from top node is reached to its dependent.

Go  back to the CRAETE CONTEXT NODEs method and double click on the last method.
Higher-level lost.jpg

We can see now they are reading the record from the second context node ( the data feed to second context node is done in the on new focus of second context node class ) and again calling the on new focus method of third context node class by sending the second context node record ( parent of last context node ).
Double click on the on new focus again, you can notice that data is fetched from using method get related entities and relationship name is the relation that we mentioned while creating third context node.
So data to the last context node is done from the second context node. This is how dependent context nodes work.
First configure the by moving required fields from available fields section to the displaying section on configuration tab.
Higher-level 13.jpg

Go to the runtime repository add our view to the overview set and save the repository.
Higher-level 14.jpg

Now that view will be available in the overview set page configuration. Move it displayed assignment blocks section. (CREATING OVERVIEW PAGE).
Higher-level 15.jpg

F8,Execute component,and testing result
Higher-level 16.jpg

回复

使用道具 举报

快速回帖

本版积分规则
您需要登录后才可以回帖 登录 | 注册有礼

快速回复 返回顶部 返回列表