on 04-22-2008 8:53 AM
Hey guys:
My dynpro application has two components, and i use main component(A) to read data from the other one(B). Component B reads data and dynamically create node and it's attribute in interface controller. After that, Component A dynamically generates a mapped node and mapping to Component B's interface controller. Also it gets attributes too.
After all of this, I should be able to have the node and data from Component B.
The problem is: I do have the dynamical node builded that mapping to Component B, and the method node.size() shows me the exact answer that I have the right number of elements.
However, I cannot read value from attribute.
node.getElementAt(i).getAttributeAsText("a1")
Shows exception: there is no such attribute.
I pretty sure the attribute name is correct, and I also print them on screen in Component B to confirm.
Please help me out of this trouble. thanks!
My code to dynamically build and map the node.
localNodeInfo = wdThis.wdGetAPI().getContext().getRootNodeInfo().addMappedChild("UploadData",null, true, false,false,null, false, true);
remoteNodeInfo = wdThis.wdGetUploadComponentInterface().wdGetAPI().getContext().getRootNode().getChildNode("UploadData",IWDNode.LEAD_SELECTION).getNodeInfo();
localNodeInfo.setMapping(remoteNodeInfo, true);
localNodeInfo.addAttributesFromDataNode();
Hi Chen
Delare the controller usage i.e delare the usage of the interface controller B in Properties of the controller where you are fetching the content.May be the attributes names dynamically
changing when ever you are creating the node structure dynamically.How you are creating your node structure?
Is the attributes are changing when every time You created node structure?.More Over see the life cycle or span of your controllers may be you are fetching the content ofter the life of the controller ends.
Even I am not sure about the exact answers but trying to trace out your problem.
Try for typed acces API node element fetching.
Regards
kalyan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey kalyan:
Thanks for the response. I recheck the items you mentioned. Most of them seem all right, but i can not make sure the life cycle of the dynamic context.
First, the application starts, and view shows. At this time, I create initial node in Component B's interface controller.
Second, User finishes operation on Component B, and Component B resets the context node and dynamically create the node and attributes in its interface controller again. After this, user click button on Component A to build the node and map it to Component B.
Is there any problem in this process? The node size in Component A and B are the same, but A cannot read the attributes by their names.
Hi Chen,
Try this.
public void wdDoInit()
{
IWDNodeInfo nodeInfo = wdContext.getNodeInfo().addChild("EmployeeNode", null,true, false, false, false, false,
true, null, null, null);
nodeInfo.addAttribute("name", "com.sap.dictionary.string");
nodeInfo.addAttribute("sal", "com.sap.dictionary.double");
IWDNode node = wdContext.wdGetAPI().getRootNode().getChildNode("EmployeeNode", IWDNode.LEAD_SELECTION);
node.addElement(node.createElement());
}
public void getEmployeeDetails()
{
IWDNode node = wdContext.wdGetAPI().getRootNode().getChildNode("EmployeeNode", IWDNode.LEAD_SELECTION);
int i = node.getCurrentElement().index();
String nm = node.getElementAt(i).getAttributeValue("name").toString();
double sl = Double.parseDouble(node.getElementAt(i).getAttributeValue("sal").toString());
}
Regards,
Mithu
Edited by: Mithu Ghosh on Apr 23, 2008 5:29 AM
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.