on 12-11-2007 1:02 PM
Hello Friends,
Actually what I need is storing some values in one method and then access them on one particular action. so as context-node are like collection, I thought to make a context-node lets say ZchkQty with two values Ztitle and ZaviabQty. ( cardinality of node is 1..n )
So I store the values like:
wdContext.currentZchkQtyElement().setZtitle(wdContext.currentZmat_FgElement().getTitle());
wdContext.currentZchkQtyElement().setZaviabQty(wdContext.currentZmat_FgElement().getZverfuegbst());
Then I want to access them like followings:
I checked the size and its 1, and actually it should be in my test case atleast 2:
wdContext.nodeZchkQty().size();
When I check this : wdContext.nodeZchkQty().getZchkQtyElementAt(i).getZtitle() then this contains the 2nd and last title, not the first one ?
I guss I am overwritting in the context node, what is the right way to store values in the context node ?
Regards,
Hi Shah,
Node cardinality is 1..n means only one element is created and you are setting the value to that element thats why value is overwriting.
Make node cardinality 0..n and Try this.
IPrivateUserComponentView.IZchkQtyElement ZchkQtyElm1 = wdContext.createZchkQtyElement();
ZchkQtyElm1.setZtitle("xxxx");
ZchkQtyElm1.setZaviabQty("10");
wdContext.nodeZchkQty().addElement(ZchkQtyElm1);
IPrivateUserComponentView.IZchkQtyElement ZchkQtyElm2 = wdContext.createZchkQtyElement();
ZchkQtyElm2.setZtitle("yyyy");
ZchkQtyElm2.setZaviabQty("20");
wdContext.nodeZchkQty().addElement(ZchkQtyElm2);
Regards,
Mithu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shah,
When u say current<xyz>Element, it takes the current selected element from the node & set the values to it.same is happening in ur case & its overwriting the same element. So in that case u need to create an element & add values to it. In that case it will create another element & ur value will be added to that element.then u can check the size & it will show size as 2
regards
Sumit
Hi Shah,
Create an element and add this to the value node.
IPrivate<Viewname>.I<nodeElement> ele = wdContext.create<nodeElement();
// Set the attributes
ele.setX();
//For each new element you need to add to node.
wdContext.node<Node>.addElement(ele);
For better understanding of this concept, you can use this tutorial
Hope this is helpful for you.
regards,
Siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
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.