Skip to Content
avatar image
Former Member

wdCopyService Error: Node has no valid parent?

I tried to do this:

WDCopyService.copyElements(wdContext.nodeResponse25(), wdContext.nodeHeader2());

However it gives the error:

"Node(DemoWSViewSearchOrder.Order.Header2): cannot bind or add elements because the node has no valid parent"

So I initiate the node with this:

IPrivateDemoWSViewSearchOrder.IHeader2Element ele2 =

wdContext.nodeHeader2().createHeader2Element();

wdContext.nodeHeader2().addElement(ele2);

However it is still giving the error:

"Node(DemoWSViewSearchOrder.Order.Header2): cannot bind or add elements because the node has no valid parent"

Any idea why?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Mar 12, 2009 at 04:50 AM

    Hi

    As you said :I initiate the node with this?

    To get facility of WDCopyService no need to initiate any node belongs to model .Only care need to take is

    Use this method after execution of the model after executing and invalidating the response node of model,

    updated data is there. now u can either bind it to any table or copy it to another node using WDCopyService.

    Regarding this error

    Node(DemoWSViewSearchOrder.Order.Header2): cannot bind or add elements because the node has no valid parent

    It need a identification of Source (which contain the updated data after executing the model), and target (where u want copy of this data)

    read this carefully

    @throws RuntimeException if target is a model node and 
       *    source is not a model node holding the same class.

    Best Regards

    Satish Kumar

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi there,

      You are right satish, I do not need to initiate anything for VALUE node.. I made a mistake somewhere.. 😊

      Thanks!

  • avatar image
    Former Member
    Mar 11, 2009 at 10:47 AM

    Hi Jackson,

    WDCopyService.copyElements(wdContext.nodeResponse25(), wdContext.nodeHeader2());

    here nodeResponse25() is the model node and Header2 is the value node, right ?.

    wdCopyservices will not work for this, instead give the valid model node which is the sub node of response node. for eg :

    if ur node structure is :

    Response - model node

    responseMsg - model node

    Output - model node

    Name - model attribute.

    and ur value node structure is :

    Header - value node

    Name - value attribute

    then use WDCopyService.copyElements(wdContext.nodeOutput, wdContext.nodeHeader());

    Note : for using the WDCopyservices , the two nodes should have same Structure (attributes with same type and ensure that even cardinality matches).

    Thanks and Regards

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thank you. Yes I am already using the immediate node above the element.

      if ur VALUE node structure is :

      Response - model node

      responseMsg - model node

      Output - model node

      Name - model attribute.

      I have to initiate all the respective node is that the case? I can't just initiate the top most node or the node that I am using?

  • avatar image
    Former Member
    Mar 12, 2009 at 02:55 AM

    Hi Jackson,

    Did you initialize the node Order?

    and I guess you must have initialized the node DemoWSViewSearchOrder.

    In fact, you need to initialize entire tree of the node Order up to top level node.

    If you have done the same, please let me know the error stack, node structure and what you are trying to do.

    Regards,

    Siva

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      Please do as following:

      if(0 >= wdContext.nodeXYZ().size()) {
          IPrivate<Your View>.IXYZElement xyzEle = wdContext.nodeXYZ().createXYZElement();
          wdContext.nodeXYZ().addElement(xyzEle);
      }
      

      Here XYZ is the node with cardinality 0..1 or 1..1.

      Hope it helps.

      Cheers,

      Manoj

  • avatar image
    Former Member
    Mar 12, 2009 at 07:08 AM

    Hi there..

    I have successfully COPIEd from Model Node (output) to Value node.

    Now I am trying to copy them into the input node of another model with same structure.. Any advise on that? When I tried to use wdCopyService, it say nodes are incompatible..

    Does that means I must do 1 attribute b y 1 attribute when copying over?

    Add comment
    10|10000 characters needed characters exceeded

    • Hi

      Sorry to mentioned it before that : for use of WDCopyService signature of the nodes should be same.

      Again u are doing mistake here that providing a input to a model node and u are using CopyService ,

      Please understand the context of uses of this standard method ,not at all related to give input to model node.

      Simplest is get the value form and set it to model node.(too many thing r there before executing the model that validation ,null pointer check. How u will achieve this by using copyService and it may u r not doing these kind of operation in your implementation ,Even then avoid this kind of uses there)

      Best Regards

      Satish Kumar