on 06-29-2006 9:39 AM
Hi all,
I have the following problem with my context element.
I have this structure in my context:
DynamicText (valueNode)
Person (valueAttribute)
SourceRegistration (valueAttribute)
Persons (valueNode in node DynamicText)
Persons (valueAttribute in node Persons)
Now im trying to fill this context data in my code like this:
IPublicTESTComponent.IDynamicTextElement dynamicText = wdContext.createDynamicTextElement();
dynamicText.setSourceRegistration("sourceRegistration");
dynamicText.setPerson("person");
Collection personList = new ArrayList();
for (int i=0; i<4; i++) {
IPersonsElement dynamicPerson = wdContext.createPersonsElement();
dynamicPerson.setPersons("test person: " +i);
personList.add(dynamicPerson);
}
wdContext.nodePersons().bind(personList);
wdContext.nodeDynamicText().bind(dynamicText);
On this code i receive the following fault message:
com.sap.tc.webdynpro.progmodel.context.ContextException: Node(TESTComponent.DynamicText.Persons): cannot bind or add elements because the node has no valid parent
How can I bind the persons on this context please?
Hi,
1)Set the Node persons of property singleton to false.
2)Add the person element to the Dynamic text node
IPublicTESTComponent.IDynamicTextElement dynamicText = wdContext.createDynamicTextElement();
dynamicText.setSourceRegistration("sourceRegistration");
dynamicText.setPerson("person");
<b>wdContext.nodeDynamicText.addElement(dynamicText);</b>
Collection personList = new ArrayList();
for (int i=0; i<4; i++) {
IPersonsElement dynamicPerson = wdContext.createPersonsElement();
dynamicPerson.setPersons("test person: " +i);
<b>dynamicText .nodePersons.addElement(dynamicPerson);</b>
}
Regards,
Vijayakhanna Raman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is "Persons" a non-singleton node (singleton=false)?
If yes, you should create the node elements like this:
IDynamicTextElement dynamicText = wdContext.createDynamicTextElement();
wdContext.nodeDynamicText().addElement(dynamicText);
dynamicText.setSourceRegistration("sourceRegistration");
dynamicText.setPerson("person");
for (int i=0; i < 4; i++)
{
IPersonsElement person = dynamicText.nodePersons().createPersonsElement();
dynamicText.nodePersons().addElement(person);
person.setPersons("test person: " + i);
}
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
The problem in the code I see DynamicText node must be supplied before Persons one because it's a parent node.
Binding the Persons node depends on property "singleton" setted on the node. If 'singleton'==false
wdContext.nodeDynamicText().bind(dynamicText);
wdContext.nodeDynamicText().getDynamicTextElementAt(0).nodePersons().bind(personList);
If 'singleton'==true ensure that 'initializeLeadSelection' property of DynamicText node is TRUE then use
wdContext.nodeDynamicText().bind(dynamicText);
wdContext.nodePersons().bind(personList);
BR
Sergei
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello B.Van,
Use the following code:
IPublicTestComponent.IDynamicTextElement dynamicText =
wdContext.createDynamicTextElement();
dynamicText.setSourceRegistration("sourceRegistration");
dynamicText.setPerson("person");
wdContext.nodeDynamicText().bind(dynamicText);
/** Bind the element first to the parent node*/
IPublicTestComponent.IPersonsElement dynamicPerson = null;
for (int i=0; i<4; i++)
{
dynamicPerson = wdContext.createPersonsElement();
dynamicPerson.setPersons("test person: " +i);
wdContext.nodePersons().addElement(dynamicPerson);
}
Bala
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.