qRules: Delete repeating group inside current repeating group - InfoPath Dev
in

InfoPath Dev

qRules: Delete repeating group inside current repeating group

Last post 05-21-2013 05:59 AM by ErnestoM. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 05-19-2013 08:03 PM

    • teylyn
    • Top 500 Contributor
    • Joined on 03-29-2012
    • Taranaki, New Zealand
    • Posts 49

    qRules: Delete repeating group inside current repeating group

    How do I delete a repeating table that is nested in a repeating section, so I can insert the correct number of rows with the Insert command? I've tried with several Xpath attempts using Current(), but no joy.

     My main data source is structured like this:

    myFields
     Container
      Orders
       Order (repeating)
        OrderDetails
         OrderDetail (repeating) 

    The Order node is deleted fine with the qRules Delete command, and then its relevant number of rows are inserted, each containing an empty OrderDetail table showing one row. In the Order repeating table rules I want to use the qRules Delete command to delete the OrderDetail node in the current Order node before it is filled again with Insert. This command does not seem to do anything:

    concat("Delete /xpath=", current()/my:OrderDetails/my:OrderDetail)

     After the Delete, I run the Insert and populate the rows with data, but the first blank row stubbornly persists. How can I get rid of it?

     cheers,

    teylyn - MS MVP (Excel) www.teylyn.com @ingeborgNZ
  • 05-20-2013 05:37 AM In reply to

    Re: qRules: Delete repeating group inside current repeating group

    Hi-

    You probably need a full xpath:

    concat("Delete /xpath=my:myFields/my:Container/my:Orders/my:Order[", current(), "]/my:OrderDetails/my:OrderDetail)

    Let us know if this works.

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


  • 05-20-2013 05:05 PM In reply to

    • teylyn
    • Top 500 Contributor
    • Joined on 03-29-2012
    • Taranaki, New Zealand
    • Posts 49

    Re: qRules: Delete repeating group inside current repeating group

    Hi, thanks for your reply.

    I tried this. It builds an XPath, but the current() function returns the value of a text field AND the SharePoint ID field, like this for the Order with the ShPID 9:

    xpath: my:myFields/my:Container/my:Orders/my:Order[Joe Bloggs9]/my:OrderDetails/my:OrderDetail

    That's weird.

    EDIT: It seems that the fields of the record that get populated will make it into the current() function. I moved a few rules that populate the order group below the Delete command and now the generated Xpath looked like this, which did not work

    my:myFields/my:Container/my:Orders/my:Order[9]/my:OrderDetails/my:OrderDetail

    But that got me on the right track. After some more tinkering, I got it to work with

    concat("Delete /xpath=my:myFields/my:Container/my:Orders/my:Order[my:ShPID = ", current(), "]/my:OrderDetails/my:OrderDetail")

     Thank you!!

    teylyn - MS MVP (Excel) www.teylyn.com @ingeborgNZ
  • 05-21-2013 05:59 AM In reply to

    Re: qRules: Delete repeating group inside current repeating group

    Glad it worked out! 

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


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