cancel
Showing results for 
Search instead for 
Did you mean: 

Two Context Nodes to show in one Table UI Element

Former Member
0 Kudos

Hi Brothers,

I have a difficult task to resolve...

My application is supposed to show the content of two different context nodes in one Table.

The Context Nodes look as follows:

Customer

4711

4712

4713

4714

Customer_txt

4711

4714

I need to show a table like this

4711 4711

4712 -

4713 -

4714 4714

Thus, I cannot just bind the Context Node to the table UI element. I guess I rather have to determine the table content at runtime.. How can i do that?

Thanks, Johannes

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Take the Context structure as

Context

TableNode

Key1

Attribute1

Attribute2

Text1

Text2

Go to Layout,outline and insert table UI element and say create binding and select this table node ...and say ok.

To bind the data to Table follow this code assuming your

first table name is Customer ,and second table name is Customer_txt

ArrayList al =new ArrayList();

for(int i=0;i<Customer.length;i++)

{

/* create the Nodeelement ehich you have binded to your table*/

IPrivate<viewName>.I<NodeElement> ele=wdContext.create<NodeElement>();

ele.setKey1(Customer.getKey1Value);

ele.setAtrribute1(Customer.getAttribute1Value);

ele.setAtrribute2(Customer.getAttribute2Value);

for(int j=0;j<Customer_txt.length;j++)

{

if(Customer.currentKey1Value.equals(Customer_txt.currentKey1Value))

{

ele.setText1(Customer_txt.getText1Value);

ele.setText2(Customer_txt.getText2Value);

}

}

al.add(ele);

}

wdContext.nodeTableNode().bind(al);

if any queries reply back

Regards

Madhavi

Edited by: madhavi kotra on Aug 26, 2008 11:50 AM

Edited by: madhavi kotra on Aug 26, 2008 11:52 AM

Answers (6)

Answers (6)

siddharth_jain
Active Contributor
0 Kudos

Hi,

Check the following thread as well:

Regards,

Siddharth

Former Member
0 Kudos

Alright, let me explain in more detail:

There are 2 tables. One is holding general information, the other is holding additional text descriptions that do not exist for every entry of the other table.

Customer

key attr1 attr2

4711 abc efg

4712 hvd kns

4713 kid ind

4714 uzr knh

Customer_txt

key txt1 txt2

4711 abc efg

4714 uzr knh

My target table should look as follows:

Customer Target Table

key attr1 attr2 txt1 txt2

4711 abc efg abc efg

4712 hvd kns

4713 kid ind

4714 uzr knh uzr knh

I hope this points it out. Can anybody post some example coding for merging the tables and binding the new table to the context (to the table UI element).

Thanks, Johannes

Former Member
0 Kudos

Hi,

Assuming your context structure is

Customer

key

attr1

attr2

Customer_txt(Child of Customer)

key

txt1

txt2

map the customer to the table data source

Write a supply function for fetching the customer_txt.

and manually bind the table cell editors to customer_txt

To acheive the following

key attr1 attr2 txt1 txt2

bind key to Customer.key

bind key to Customer.attr1

bind key to Customer.attr2

bind key to Customer_txt.txt1

bind key to Customer_txt.txt2

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

Fine. This requires some logic to be written. You need to have a node having the structure required for the target table containing all the attributes required.

Now loop through the first node i.e Customer and set the attributes key, attr1,attr2 to your Customer Target Table (after creating the new element for this node). After this Customer Target Table node will have four elements (as in your example).

Now loop through Customer Target Table node and inside this loop with Customer_txt node. Check

if(Customer_Target_Table.key.equals(Customer_txt.key)) {

set the remaining two attributes of the target table.

break;

}

Go to next element of the target table.

Hope records are not repeating.

thanks & regards,

Manoj

Former Member
0 Kudos

Binding table cell editors to two different nodes will not give you the result you want. Bind the data source of the table to the node "Customer".

To get the additional table columns, you can add additional attributes "txt1", "txt2" to node "Customer" and either implement them as calculated attributes or compute their values in the supply function of node "Customer". It might be useful to provide fast access (e.g. by using a hash map) to get the text description for a customer.

Armin

Former Member
0 Kudos

Hi,

If i understood your requirement correctly then you need to map two attributes from two different nodes to two columns inside a table.

If so then you can do so at the design time itself. Click on the TableCellEditor and select the required attribute for the property text.

thanks & regards,

Manoj

Former Member
0 Kudos

Hi,

Create a calculated attribute and concat the values in the get method.

bind this to the table.

Regards

Ayyapparaj

former_member194668
Active Participant
0 Kudos

Hi Johannes,

Create a new context node with the common attributes from other 2 tables.

At the run time loop thru the tables and populate the new table.

You can bind only one node to the table.

-Aarthi

Former Member
0 Kudos

Hi Johannes,

Refer to the following thread which might help you.

Thanks & Regards,

Jhansi Miryala