Delete Single Row from Repeating Table - InfoPath Dev
in

InfoPath Dev

Delete Single Row from Repeating Table

Last post 10-21-2013 06:07 AM by Sproctor722. 20 replies.
Page 1 of 2 (21 items) 1 2 Next >
Sort Posts: Previous Next
  • 10-16-2013 09:31 PM

    Delete Single Row from Repeating Table

    I have a repeating table (main data source) where I have copied data from a secondary data source using qRules.  Based on changes made in the secondary source rows are inserted as expected, however if the row is returned to its original state (Director changed from John Smith to John Adams add a row to the table.  If John Adams is changed back to John smith I want to delete the row from the table.)  I had a formatting rule on the table which hid the row, but when submit was clicked..the row stilled submitted to the list.  Is there a way using qRules to delete jus the row that meets my criteria and not everything in the repeating table

      Rows are inserted into the main data source (for submit to SharePoint) whenever any of these columns are not equal.  When a change occurs in the secondary source and all these columns are again equal I need a rule to delete only the record where this condition is true.  Any help is greatly appreciated.

     


  • 10-17-2013 06:42 AM In reply to

    Re: Delete Single Row from Repeating Table

     Some of your screenshots are not showing up - but the short answer is "yes". The Delete command's xpath parameter can have a filter in it indicating which row to delete. You can use a concat statement for the command - like:

    concat("Delete /xpath=my:myFields/my:group1/my:group2[my:field2 = '", fieldSomethingElse, "']")

    Hilary Stoupa

  • 10-17-2013 07:10 AM In reply to

    Re: Delete Single Row from Repeating Table

     The highlighted directors have been changed in the first table.  The below shows that pb Director (Allan) has been changed.  First record to Dan and the other Chris.  I want just the current Item being changed that meets my criteria.  I used ID to get the record into the table, but it doesn't seem to work at all when I change Insert to delete.  Here's what I tried.

    concat("Delete /xpath=my:myFields/my:BPResults/my:BPSubmit[last()]/my:ID /value=", ID)

     

     


  • 10-17-2013 07:29 AM In reply to

    Re: Delete Single Row from Repeating Table

     So - that is not the correct syntax for the delete command, first off - you may want to refer to the user guide. You want to delete the whole row of BPSubmit for a certain condition, right?

    Hilary Stoupa

  • 10-17-2013 07:30 AM In reply to

    Re: Delete Single Row from Repeating Table

     Yes, the entire row for the current item.

  • 10-17-2013 07:38 AM In reply to

    Re: Delete Single Row from Repeating Table

     Sorry - I'm still having trouble understanding. Can you attach your form under the options tab?

    Hilary Stoupa

  • 10-17-2013 07:42 AM In reply to

    Re: Delete Single Row from Repeating Table

     Your first example helped.  I was just referencing the wrong field in the "something else" part of the command.

    concat("Delete /xpath=my:myFields/my:BPResults/my:BPSubmit[my:ID = '", ID, "']")

     

    this worked beautifully.  Thank you again.  You are absolutely the best EVER!!!  

  • 10-17-2013 07:48 AM In reply to

    Re: Delete Single Row from Repeating Table

     Perfect, glad you have it working! :)

    Hilary Stoupa

  • 10-17-2013 09:23 AM In reply to

    Re: Delete Single Row from Repeating Table

     New issue.  It works great as long as I only make changes in one column.  If I make changes in other columns it stops working properly.  I put the rule on each field that could change in the repeating table.


  • 10-17-2013 09:44 AM In reply to

    Re: Delete Single Row from Repeating Table

     Not sure if I have the correct user guide.  It's 50 pages but I don't see a section that shows the correct syntax for the delete command.

  • 10-17-2013 09:46 AM In reply to

    Re: Delete Single Row from Repeating Table

    Never mind.  I needed to look in the command overview document.

  • 10-17-2013 10:48 AM In reply to

    Re: Delete Single Row from Repeating Table

     I couldn't find anything in the command overview that gave an example of filtering the xpath in the delete command.

  • 10-17-2013 10:51 AM In reply to

    Re: Delete Single Row from Repeating Table

     I should have been more specific. Your attempt was:

    concat("Delete /xpath=my:myFields/my:BPResults/my:BPSubmit[last()]/my:ID /value=", ID)

    The Delete command does not have a /value parameter.

    Hilary Stoupa

  • 10-17-2013 11:02 AM In reply to

    Re: Delete Single Row from Repeating Table

     This is the code that worked for me

    concat("Delete /xpath=my:myFields/my:BPResults/my:BPSubmit[my:ID = '", ID, "']")

    but it only works one column at a time.  If I change more than one column my inserts stop working and the delete no longer works.  I'm sure I need to get the current ID to get the exact row, but I'm not sure how to do it.  I've tried putting a filter on the ID (which is the ID from the secondary source) but that doesn't work either.  I'm at a loss.  Would this be a better way to target the row I want deleted.

    concat("Delete /xpath=my:myFields/my:BPResults/my:BPSubmit[last()]/my:ID =", ID)  or would I replace last() with current()?

  • 10-17-2013 11:06 AM In reply to

    Re: Delete Single Row from Repeating Table

     Like I said before, I'm still having trouble understanding what row you are trying to delete.

    At any rate, the /xpath parameter for your delete command needs to be the XPath to the repeating element(s) you want to delete. Are you trying to delete the last instance of a row that matches the ID of the row your are currently in? I'm sorry, I'm just not understanding what you are trying to accomplish. Post your form if you want me to take a quick look and maybe I can give you a hand.

    Hilary Stoupa

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