cancel
Showing results for 
Search instead for 
Did you mean: 

GP - Pass a stucture output from a WD CO

Former Member
0 Kudos

Hello,

I've a scenario where in I need to pass a set of values entered by the user on a WD table. i.e effectively as a structure containing a collection of data. I tried using the following code but without any success.

In the action handler I've the followng code:

IGPStructure output = executionContext.getOutputStructure();
IGPStructure struct = output.addStructure("OUTPUT") ;

for(int i=0; i<wdContext.nodeTable().size() ; i++)
{		
            ITableElement element = wdContext.nodeTable().getTableElementAt(i); 
            struct.setAttributeValue("param1",  element.getP1()); 
            struct.setAttributeValue("param2",  element.getP2()); 
            struct.setAttributeValue("param3",  element.getP3()); 
}

Through this code I got only the last record in the structure. I cannot use setAttributeValues(String,collection) as the attributes' cardinality should be 0:1.

Any leads in this regard will be highly appreciated.

Thanks,

Bala

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

This is because your structure 'OUTPUT' is set to a cardinality of 1:1. Try inserting:

struct.setMultiplicity(IGPStructureInfo.MULITIPLICITY_0_N);

after

IGPStructure struct = output.addStructure("OUTPUT");

which will set it to 0:N.

~Greg

Answers (1)

Answers (1)

Former Member
0 Kudos

It was indeed a problem in the Datatype of the attributes at the recieving end. I'd already set the cardinality to 0:N, but didn't mention that in the thread. Any ways, maintaining a uniform datatype solved the problem.

Bala