cancel
Showing results for 
Search instead for 
Did you mean: 

Create two tables based on the data

Former Member
0 Kudos

I have a node - 'outnode'.

I have three records - two records with fieldvalue '1' and one record with a value '2'.

at the max only two diff values possible.

Now.. I need to create two tables : first one should have the two records with value 1 and second table with a record that has value '2'.

Please help.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi!

You can do it this way :


//fill outnode with dummy data
boolean b = false;
for (int i = 1; i <= 101; i++)
{
  IPrivateExampleView.IOutnodeElement outNodeElement = 
		wdContext.createOutnodeElement();
  if (b){
	outNodeElement.setFieldValue(1);
	b = !b;
  }
  else{
	outNodeElement.setFieldValue(2);
	b = !b;
  }
  wdContext.nodeOutnode().addElement(outNodeElement);
}
  	
//fill tables 1 (nodeSourceTable1) and 2 (nodeSourceTable2)
//according to outnode's values
for (int i=0; i<wdContext.nodeOutnode().size(); i++)
{
  wdContext.nodeOutnode().setLeadSelection(i);
  if (wdContext.currentOutnodeElement().getFieldValue()==1)
  {
	IPrivateExampleView.ISourceTable1Element Source1Element = 
			wdContext.createSourceTable1Element();
	Source1Element.setFieldValue(1);
	wdContext.nodeSourceTable1().addElement(Source1Element);
  }
  else
  {
	IPrivateExampleView.ISourceTable2Element Source2Element = 
			wdContext.createSourceTable2Element();
	Source2Element.setFieldValue(2);
	wdContext.nodeSourceTable2().addElement(Source2Element);
  }
}  

Regards.

Julio Herrera

Edited by: Julio Cesar Herrera on Jan 3, 2008 7:15 PM

Yay, just learned to use blocks and corrected this post

Answers (0)