on 09-26-2009 7:04 AM
Hi all,
i have a context like this:
Order (0...n)
L---LineItem (0...n)
. . L----ProductNo
. . L----Quantity
L CustomerName
L Address
I have no problem setting values for the Order level, but how to set values for the LineItem level?
this is how i create the Order level.
IOrderElement ele = wdContext.nodeOrder.createOrderElement();
ele.setCustomerName("Bob");
ele.setAddres("Some address");
wdContext.nodeOrder.addElement(ele);
IOrderElement ele = wdContext.nodeOrder.createOrderElement();
ele.setCustomerName("John");
ele.setAddres("Some other address");
wdContext.nodeOrder.addElement(ele);
but when i try to create the LineItem level using the same way, they all add to the first element of the Order node.
how to add LineItem element to the correct element of the order element?
Thanks.
It depends. If the inner node is a non-singleton child node, then every element of the outer node has its own instance of the inner node and you can access this like
IOrderElement order = ...;
/* create and add line item to order: */
ILineItemElement item = order.nodeLineItem().createAndAddLineItemElement();
/* access all line items for order: */
for (int i = 0; i < order.nodeLineItem().size(); ++i)
{
ILineItemElement item = order.nodeLineItem().getLineItemElementAt(i);
}
If the inner node is a singleton child node, it exists only for the lead selected element of the parent node. The current instance can then be accessed like
wdContext.currentOrderElement().nodeLineItem();
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That means the inner node "LineItem" is singleton, right? In that case, define a supply function for this node like
void supplyLineItem(ILineItemNode node, IWDNodeElement parentElement)
{
IOrderElement order = (IOrderElement) parentElement;
ILineItemElement item = node.createAndAddLineItemElement();
// etc
}
Armin
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
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.