on 01-30-2009 7:09 PM
I need this to fill a node inside another node, how do I do this?
I try this code:
...IPrivatePruebaView.IDatosElement da = wdContext.nodeDatos().createDatosElement();
da.setDatos2("data2");
da.setDatos3("data3");
for(int i=0;i<=10;i++)
{
IPrivatePruebaView.IDato1Element dat = wdContext.nodeDato1().createDato1Element();
dat.setDato11(String.valueOf(i));
wdContext.nodeDatos().nodeDato1().addElement(dat);
}
wdContext.nodeDatos().addElement(da);...
but when I run the fields are locked
What can I do that?
hi Pablo,
For filling child node for all elements in the parent node, you have to set singleton property of the child node to false.
Node
---text1
---text2
-
SubNode(singleton=false)
-
text3
-
text4
IPrivate<view>View.INodeElement nodeElement = wdContext.nodeNode().createNodeElement();
wdContext.nodeNode().addElement(nodeElement);
//To add elements to the subnode
IPrivate<view>View.ISubNodeNode subNode=nodeElement.nodeSubNode() ; //access child node
IPrivate<view>View.ISubNodeNodeElement subNodeElement = subNode.createSubNodeElement();
subNode.addElement(subNodeElemeny);
If the singleton property for subnode is set to true, you can access the subnode independent of the parent node.
IPrivate<view>View.ISubNodeNode subNode=wdContext.nodeSubNode() ; //access child node
Hope this helps!
Monalisa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Just try this code.
IPrivatePruebaView.IDatosElement da = wdContext.nodeDatos().createDatosElement();
da.setDatos2("data2");
da.setDatos3("data3");
for(int i=0;i<=10;i++)
{
IPrivatePruebaView.IDato1Element dat = wdContext.nodeDato1().createDato1Element();
dat.setDato11(String.valueOf(i));
wdContext.nodeDato1().addElement(dat);
}
wdContext.nodeDatos().addElement(da);
Regards,
H.V.Swathi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please post the exact context structure. Is the subnode a non-singleton node?
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
suppose the context look like
ROOT
|-Datos (cardinality 0..n)
|--Datos1 (cardinality 0..n)
There are few more attributes which determines the run-time behavior of Contexts.
[Context properties|http://help.sap.com/saphelp_nw04s/helpdata/en/47/45641880f81962e10000000a114a6b/content.htm]
code to add a sub node
// create parent element
IPrivatePruebaView.IDatosElement datosel = wdContext.createDatosElement();
// .. set attributes here....
// adds element
wdContext.nodeDatosElement().addElement( datosel);
// create child element
IPrivatePruebaView.IDatos1Element datos1el = wdContext.createDatos1Element();
// .. set attributes here....
// adds element
wdContext.nodeDatos1Element().addElement( datos1el);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi..
To access sub node ,u need not use parent node to navigate.
you can also use,
wdContext.nodeDato1().addElement(dat);
Regards,
Alamelu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pablo,
If you want to add data inside another node the code should be something like this.
IPrivatePruebaView.IDatosElement da = wdContext.nodeDatos().createDatosElement();
wdContext.nodeDatos().addElement(da);
da.setDatos2("data2");
da.setDatos3("data3");
wdContext.nodeDatos().setLeadSelection(da.index());
for(int i=0;i<=10;i++)
{
IPrivatePruebaView.IDato1Element dat = wdContext.nodeDato1().createDato1Element();
dat.setDato11(String.valueOf(i));
wdContext.nodeDatos().nodeDato1().addElement(dat);
}
assuming
-- Datos
- - - - -Dato1
The mistake that you have done in your code is, when you were adding the newly created Dato1Element the DatosElement has not been added to the DatosNode. When you call
wdContext.nodeDatos().nodeDato1().addElement(dat);
Your Datos Node is empty.
Data1Element will be added to the leadselected element of Datos. Since you have not added any element to the Datos node yet your addElement will fail (provided the cardinality of the Datos node is 0:1 or 0:n).
Hence the fields are locked.
Hope this helps.
Regards,
Sanyev
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 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
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.