CopyTable to dynamic / multiple xpaths and nested repeating nodes - InfoPath Dev
in

InfoPath Dev

CopyTable to dynamic / multiple xpaths and nested repeating nodes

Last post 11-10-2010 10:02 AM by joanfuture. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 11-07-2010 07:06 AM

    CopyTable to dynamic / multiple xpaths and nested repeating nodes

    Hallo again,

    I am running into an error using the CopyTable Command. I would like to copy all PropertyData from the first person node to the others. Here is the structure.

    my:UserDataChangeRequest
        my:people
            my:person   (repeating, each node has an integer-index I can address)
                my:ActiveDirectoryFields
                    my:PropertyData   (repeating)

    I run the folloing the qrules command.

    CopyTable /tablesrc=/my:UserDataChangeRequest/my:people/my:person[my:index=1]/my:ActiveDirectoryFields /rowsrc=my:PropertyData /tabledest=/my:UserDataChangeRequest/my:people/my:person[my:index>1]/my:ActiveDirectoryFields /rowdest=my:PropertyData /empty=yes

    and get this error:

    An error has occurred executing the rule. Failed to select the destination row to copy to.

    Maybe I don't understand the conditions under which this command may run. Is this at all defined to copy data to more than one table at once. In this example there could be more than person node, so I want to copy the data to all persons with index > 1.

    I tried to get the replace-Command to work as well, but seem to run into the same errors. Is the Replace-command defined to work with multiple Targets like I am trying to get to work here?

    What do you think?
    Thankyou
    Michael

    Filed under: ,
  • 11-07-2010 08:54 AM In reply to

    Re: CopyTable to dynamic / multiple xpaths and nested repeating nodes

    Neither the CopyTable command nor the Replace command is designed to work with multiple targets.  There is a way around that which I will get to in a second.

     

    I am puzzled that you are getting that error. The behavior I would think you'd find is that the data would get copied to the first my:person with index > 1 and none of the others.  Are you sure that there are nodes with my:index > 1 when you are doing this?

     

    Now for the workaround.  The solution is to put have a new node (let's call it my:copy) on each my:person node that will trigger a copy operation for that particular my:person node, and to perform a modification of my:copy's value whenever you want to perform that copy.  This way the command gets invoked once for each destination my:person node.

    The attached form simulates this action using message boxes.  In your actual form, you would naturally instead be setting the qRules command node value instead of showing expression boxes, but this should give you an idea of what to do.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 11-07-2010 09:23 AM In reply to

    Re: CopyTable to dynamic / multiple xpaths and nested repeating nodes

    Hi Jimmy,

    you are right, the values are copied only to the first person that has an index > 1. The replace Command has the same behaviour.

    Thank you for the form, I am already working on that approach, I am familiar with this technique and I like it, but will I not have to expect running into the fantastic microsoft rule loop-exception, when I update more than 16 Person-nodes at once?

    I will know by tomorrow and post the results here.

    Great, my infopath- form has become pretty cool thanks ONLY to qrules :-) There is no resonable and/or costeffective way, I could get these pretty-intelligent and intuitive-to-use forms done if I had not qrules :-)  and this forum!
    I will give an update tomorrow.

    thanks again
    bye Michael

  • 11-07-2010 10:00 AM In reply to

    Re: CopyTable to dynamic / multiple xpaths and nested repeating nodes

    The "infinite loop" restriction only applies when a rule directly or indirectly causes itself to be reinvoked 16 times.  Since each my:copy node rule executes only once in its own chain of events, this approach is not vulnerable to that limitation.

     And thank you for always providing such positive comments!  :-)

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 11-10-2010 10:02 AM In reply to

    Re: CopyTable to dynamic / multiple xpaths and nested repeating nodes

    Hi Jimmy,

    just wanted to let you know, that everything worked out pretty fine.

    thx
    Michael

Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.