cancel
Showing results for 
Search instead for 
Did you mean: 

Context STructure to GP output structure

Former Member
0 Kudos

Hi All,

I have problems with adding an context structure to an output structure.

Defining Code in execution-method:

IGPStructureInfo outputStructure = technicalDescription.getOutputStructureInfo();
IGPStructureInfo structure = outputStructure.addStructure("UserStructure");
structure.setMultiplicity(IGPAttributeInfo.MULITIPLICITY_0_N );
structure.addAttribute("UserID", IGPAttributeInfo.BASE_STRING);

The context structure is designed in the following way:


TableStructure
   -->USERID
   -->USERNAME

How can I add the values from the context to my output structure?

Thanks for valueable helps

Bye Steve

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Steve,

try this:


IGPStructure outputStructure = technicalDescription.getOutputStructure();
IGPStructure userStruct = outputStructure.addStructure("UserStructure") ;
userStruct.setAttributeValue("UserID", value);

Aliaskei

Former Member
0 Kudos

Hi Aliaksei,

the first Line in your is impossible, because you only get OutputStructureInfo with technicalDescription.

It is necessary to take the executionCOntext to get the OutputStructure.

But after correcting your code the problem still exists.

The only difference between our codings ist that you take addStructure, but that also doesnt fix the problem.

The error must exist in the following line, because I commented it out and the code works (but not in the way i want):

outputStructure.addStructure("UserStructure").setAttributeValue("UserId", element.getUSERID())

Bye Steve

Former Member
0 Kudos

Sorry Aliaksei,

but now it works fine.

Your code with addStructure was the right way.

Thanks

Steve

Answers (2)

Answers (2)

Former Member
0 Kudos

Sorry, I was in hurry...

I thought you want to add values to output structure at runtime.

So,

IGPStructureInfo structureInfo = desc.getInputStructureInfo() ;

IGPAttributeInfo attr = structureInfo.addAttribute("UserID", 0) ;

attr.setMultiplicity(IGPAttributeInfo.MULITIPLICITY_1_N) ;

attr.setType(IGPAttributeInfo.BASE_STRING) ;

attr.setNameKey(TXT_CO_INSTANCE_ID) ;

Aliaksei

Former Member
0 Kudos

My own soltuion doesnt work

for(int i=0; i<wdContext.nodeTableStructure().size() ; i++){		
	ITableStructureElement element = wdContext.nodeTableStructure().getTableStructureElementAt(i); 
	outputStructure.getStructure("UserStructure").setAttributeValue("UserId", element.getUSERID()); 
		}