Insert node within nested repeating node - InfoPath Dev
in

InfoPath Dev

Insert node within nested repeating node

Last post 06-12-2013 04:58 PM by Hilary Stoupa. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 06-11-2013 04:51 PM

    • MrWilde
    • Top 500 Contributor
      Male
    • Joined on 12-29-2011
    • Brisbane, Australia
    • Posts 40

    Insert node within nested repeating node

    I have been looking through the posts for more info regarding this but still missing some bits.

    Fields layout attached

    I have tried

    Insert /parent=/my:myFields/my:CCProjectFields/my:CCHeaders/my:CCDetails /child=my:CCDetail

    and also

    Insert /parent=/my:myFields/my:CCProjectFields/my:CCHeaders/my:CCDetails /xpathsrc=/my:myFields/my:CCProjectFields/my:CCHeaders/my:CCDetails/my:CCDetail

    is there something need in the parent parameter to point to the correct parrent as it is repeating section?


  • 06-12-2013 06:06 AM In reply to

    Re: Insert node within nested repeating node

    Hi-

    Yes, CCHeaders is repeating, so we'd need to establish which parent row receives the Insert.

    e.g.

    /parent=/my:myFields/my:CCProjectFields/my:CCHeaders[1]/my:CCDetails

    /parent=/my:myFields/my:CCProjectFields/my:CCHeaders[2]/my:CCDetails

    I wonder if the firstparentonly parameter is needed in your scenario.

    When the form has a repeating group (child) within a repeating group (parent), the schema may have multiple parents. Executing the Insert command with /firstparentonly set to true (or not declared) means that only the first parent will receive the action specified by the Insert command. If /firstparentonly is set to false, then EVERY parent node will receive the action specified by the Insert command.

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 06-12-2013 06:33 AM In reply to

    • MrWilde
    • Top 500 Contributor
      Male
    • Joined on 12-29-2011
    • Brisbane, Australia
    • Posts 40

    Re: Insert node within nested repeating node

    Ok so how do you establish witch parent gets the row? There will be multiple parents and multiple children for each parent. Only First Parent should receive the command so don't need that. Just not sure of the syntax for the /parent parameter
  • 06-12-2013 07:40 AM In reply to

    Re: Insert node within nested repeating node

     I usually use a count of preceding sibling + 1 for this - it really depends on things like where your rule is, what your desired outcome is, etc, but my general approach is like this:

    concat("Insert /parent=/my:myFields/my:CCProjectFields/my:CCHeaders[", count(preceding-sibling::my:CCHeaders) + 1, "]/my:CCDetails /xpathsrc=/my:myFields/my:CCProjectFields/my:CCHeaders/my:CCDetails/my:CCDetail")

    Hilary Stoupa

  • 06-12-2013 03:01 PM In reply to

    • MrWilde
    • Top 500 Contributor
      Male
    • Joined on 12-29-2011
    • Brisbane, Australia
    • Posts 40

    Re: Insert node within nested repeating node

    excellent thanks Hillary. I wasn't sure of the correct syntax I haven't been able to find any good resources on advanced InfoPath dev, except of course this site.
  • 06-12-2013 04:18 PM In reply to

    • MrWilde
    • Top 500 Contributor
      Male
    • Joined on 12-29-2011
    • Brisbane, Australia
    • Posts 40

    Re: Insert node within nested repeating node

    I tried the parameter details you gave but still getting error

    Failed to insert the child node. Extended Details: Qdabra.Tools.RulesLibrary.RulesLibraryException: Failed to insert the child node. at Qdabra.Tools.RulesLibrary.Commands.PerformInsert(String child, String posn, XPathNavigator parentNode, XPathNavigator childNode, XPathNavigator beforeNode, Int32 position, Int32 insertCount) at Qdabra.Tools.RulesLibrary.Commands.PerformInsertOuter(String child, String before, String posn, String count, XPathNavigator parentNode, XPathNavigator childNode) at Qdabra.Tools.RulesLibrary.Commands.Insert() at Qdabra.Tools.RulesLibrary.Commands.RunCommand(String commandName) at Qdabra.Tools.RulesLibrary.Commands.ExecuteCommand()

    not sure if I am in the right place with the button? here is a link to the xsn if you have time to have a quick look that would be so helpful. MonthlyXSN
  • 06-12-2013 04:38 PM In reply to

    Re: Insert node within nested repeating node

     Oh, sorry, your repeating group needs to be the bottom most in your parent group - see attached screenshot. I circled the nodes I moved - then both commands work as anticipated.


    Hilary Stoupa

  • 06-12-2013 04:44 PM In reply to

    • MrWilde
    • Top 500 Contributor
      Male
    • Joined on 12-29-2011
    • Brisbane, Australia
    • Posts 40

    Re: Insert node within nested repeating node

    Completed some testing and found the issue. there is a subtotal in the group that preventing from running.

    So now need to figure out how to have a subtotal for each of the nested groups as well as the Total for all the expense

  • 06-12-2013 04:45 PM In reply to

    • MrWilde
    • Top 500 Contributor
      Male
    • Joined on 12-29-2011
    • Brisbane, Australia
    • Posts 40

    Re: Insert node within nested repeating node

    WOW great minds and all that jazz

    thanks Hillary

  • 06-12-2013 04:56 PM In reply to

    • MrWilde
    • Top 500 Contributor
      Male
    • Joined on 12-29-2011
    • Brisbane, Australia
    • Posts 40

    Re: Insert node within nested repeating node

    Just wanted to confirm that works great, thanks again

  • 06-12-2013 04:58 PM In reply to

    Re: Insert node within nested repeating node

     Perfect, glad you are up -n- running. :)

    Hilary Stoupa

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