cancel
Showing results for 
Search instead for 
Did you mean: 

Display Data from multiple models in one table

Former Member
0 Kudos

Hi Experts,

Is it possible to display data from multiple models in one table smltnsly.

I have created a table dynamically.Now I would like to display data from multiple models... If this possible,can anyone give me a lead as to how to do it..

Regards

SU

Accepted Solutions (1)

Accepted Solutions (1)

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

You can bind only one Node to a Table control.

So you create a value node and add attributes you want to display.

Loop through all the Model nodes and add it to the value node.

Regards

Abhimanyu L

Former Member
0 Kudos

THanks for the same...if you can paste some sample code on this regard, it will be really good for me..

Thanks

Su

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

Your Model Nodes be

Model1

---Output_Model1

-


Attrib1

-


Attrib2

Model2

---Output_model2

-


Attrib1

-


Attrib2

and the value node is

ValueNode

---Attrib1

---Attrib2

Now the coding.

int size;

IPrivate<ViewName>.IOutput_mode1Node node1 = wdContext.nodeOuptut_Model1();

IPrivate<ViewName>.IValueNodeElement elem;

size = node1.size();

for(int i=0; i<size; i++)

{

elem = wdContext.createValueNodeElement();

elem.setAttrib1( node1.getOutput_Model1ElementAt(i).getAttrib1() );

elem.setAttrib2( node1.getOutput_Model1ElementAt(i).getAttrib2();

wdContext.nodeValueNode().addElement( elem );

}

similar code for Model Node 2

Regards

Abhimanyu L

Former Member
0 Kudos

One more question,How I will include these in the Table?...

Just one line of example it will be good..

Regards

SU.

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

You can not bind multiple nodes to a table control.

You create only one Value Node, create the columns as attributes to this node and bind it with the Table Control.

and copy nodes data into this value node...

Regards

Abhimanyu L

Former Member
0 Kudos

Would really appreciate if you can put some sample code this also...

I just started WD for JAVA recently..still long way to go..

Thanks in Advance..

SU

Former Member
0 Kudos

Hi SU,

I think the code ,what abhimanyu has sent is sufficient.U can follow these steps:

1. Create a value node with all the attributes u want in ur table.

2. In the layout,create a table using apply template & give the value node as data source.

3. Use the code what abhimanyu has sent for copying the data from model node to value node.

That's all

regards

Sumit

Former Member
0 Kudos

Thanks for the reply..

One more question...

In my scenario, there are chances that same data will be present in the multiple models... How do we check th same in WD.?

Regards

SU

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks for the reply..

One more question...

In my scenario, there are chances that same data will be present in the multiple models... How do we check th same in WD.?

Regards

SU

Former Member
0 Kudos

.

Former Member
0 Kudos

Hi Su,

In that case also its same.U have to loop thru all the model nodes & get the data.Put that data in ur value node.

Its same like getting the data from different collections in java and putting in a different collection.

regards

Sumit

Former Member
0 Kudos

Thanks for the reply...Any sample code will be appreciated....

Thanks in advance..

Regards

SU

Former Member
0 Kudos

Hi SU,

Sample code is already provided by Abhimanyu.

regards

Sumit

Former Member
0 Kudos

Thanks for the reply...I was asking sample code for looping two models for checking the data which are equal..

Regards

SU