cancel
Showing results for 
Search instead for 
Did you mean: 

Adding data to node with cardinality 0..n

0 Kudos

Hi All,

I am working on an example that requires data to be populated to the controller context node(cardinality 0..n) with information. This controller context is used in multiple views. I collect some data in one view and some data in another view. This context node is has the following structure

|-Context

|-ToModel

|-BusinessPartner (cardinality 0..n - structure ZBUPA)

- BusinessPartnerRole

- BusinessPartnerNo

I am expecting the following result in the node:

BusinessPartnerRole BusinessPartnerNo

1 -


115

2 -


115

3 -


115

I tried using the following piece of code. It didn't work

ZBUPA partner = new ZBUPA();

partner.BusinessPartnerRole("1");

partner.setBusinessPartner("115");

IPrivatePartnerInformation.IBusinessPartnerElement newPartnerNodeElement;

newPartnerNodeElement = wdContext.createIBusinessPartnerElement(partner);

wdContext.nodeToModel().nodeIBusinessPartner().addElement(newPartnerNodeElement);

Any guidance will be greatly appreciated.

Thanks and regards,

Hemanth

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

It seems (according your code) that

1. BusinessPartner is child node of ToModel node

2. BusinessPartner is singleton node

Probably you have to make BusinessPartner node non-singleton?

VS

0 Kudos

I could solve the problem with the following piece of code.

ZBUPA partner = new ZBUPA();

partner.BusinessPartnerRole("1");

partner.setBusinessPartner("115");

wdContext.currentToModelElement().modelobject.addIBussinessPartner(partner).

Former Member
0 Kudos

Hi Hemanth

Try this

IPrivatePartnerInformation.IBusinessPartnerElement newPartnerNodeElement; 
newPartnerNodeElement = wdContext.createIBusinessPartnerElement();
newPartnerNodeElement.setBusinessPartnerRole("1");
newPartnerNodeElement.setBusinessPartner("115");

wdContext.nodeToModel().nodeIBusinessPartner().addElement(newPartnerNodeElement);

Regards

Pran