on 08-06-2008 1:05 PM
Hi,
Who knows to access and create the following context properly?
I have the following context:
Table 1..1
TableList 1..1 |
TableWrapper 0..n
Data 0..1 |
- name
- age
How to add the name and age to a newly created TableWrapper via Data Node?
IWrapperElement elWr = wdContext.nodeTableWrapper().createTableWrapperElement();
and then how to access data node properly??
Kind regards,
Sandhya
Hi,
Table 1..1
TableList 1..1
TableWrapper 0..n
Data 0..1
- name
- age
If your context structure is as shown above
Table and TableList is having cardinality 1..1 so you dont have to create one explicitly.
TableWrapper needed to be created as its 0..n
Following code is used to create one element of table wrapper
ITableWrapperElement element = wdContext.nodeTableWrapper().createAndAddTableWrapperElement();
Now for the element of TableWrapper create a element for the datanode
wdContext.nodeTableWrapper().setLeadSelection(element.index());
IDataElement dataElement = wdContext.nodeTableWrapper().nodeData().createAndAddDataElement();
hope its clear
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I found the solution.
for(int i = 0; i < k ; i++) {
ITableWrapperElement elWr =wdContext.nodetableList().nodeTableWrapper().createTableWrapperElement();
wdContext.nodeTableWrapper().addElement(elWr);
IDataElement dataEl = elWr.nodeData().createNodeDataElement();
dataEl.setAge("23");
dataEl.setname("Santino");
elWr.nodeData().bind(dataEl);
}
Hi,
IDataNodeElement ele= wdContext.nodeDataNode().currentDataNodeElement();
if(ele!=null){
ele.getName();
ele.getAge();
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Table Node contains TableList Node.
TableList Noed contains TableWrappers Node.
TableWrapper Node contains the Data Node.
Data Node contains the attributes age and name.
IWDNodeElement nodeElement = wdContext.nodeTableWrapper.createAndAddElement();
IWDNodeElement datanodeElement = nodeElement.createAndAddDataNodeElement();
datanodeElement.setAttribute("<attributeName>","<value>");
datanodeElement.setAttribute("name","AAA");
datanodeElement.setAttribute("age","1");
Regards
Ayyapparaj
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
7 | |
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.