Delete row from a repeating table using QRules - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Delete row from a repeating table using QRules

Last post 01-02-2019 10:33 AM by Daniel_5584. 13 replies.
Page 1 of 1 (14 items)
Sort Posts: Previous Next
  • 01-04-2012 04:47 AM

    Delete row from a repeating table using QRules

    I have searched the forums and the Internet, but somehow the answers eludes me. How can i make a Rule that only deletes the current row in a repeating table? I can delete a specific line number, but how to retrieve that?
  • 01-04-2012 05:02 AM In reply to

    Re: Delete row from a repeating table using QRules

    Assuming you have the delete button in each row of the repeating table, it would be something like:

    concat("Delete /xpath=/my:path/my:to/my:repeatingGroup[", count(preceding-sibling::my:repeatingGroup) + 1, "]")

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 01-04-2012 06:54 AM In reply to

    Re: Delete row from a repeating table using QRules

    Got it! Only thing the example needed was a space before the final comma to pass the formula validation (apart from the correct XPath of course).

     Thanks!

  • 01-04-2012 07:33 AM In reply to

    Re: Delete row from a repeating table using QRules

    That's odd.  I wouldn't expect it to need a space before the comma there.  At any rate, I'm glad it helped!

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 01-14-2012 11:12 AM In reply to

    • Leinweber
    • Top 500 Contributor
    • Joined on 11-17-2011
    • Chicago, Illinois
    • Posts 26

    Re: Delete row from a repeating table using QRules

    Would this work if I am popluating my repeating table with data from a SharePoint list? I have a repeating table that is bound to a data connection that pulls rows from a SharePoint list. I want my InfoPath form users to be able to delete rows in the SharePoint list from the form. I added a button with an on-click rule to run the following Qdabra command:

    concat("Delete /xpath=/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW[", count(preceding-sibling::SharePointListItem_RW) + 1, "]")

    When I preview my form, the data from the SharePoint list is displayed in the repeating table with a delete button next to each record. When I click on the delete button ... well nothing happens. The data stays in the SharePoint List and no information is displayed in the Qdabra Results, Success, or Error controls I have placed at the bottom of the form to help me debug the issue.

    Am I going about this the right way? Is there a different way I should be doing this?

     

     

  • 01-14-2012 05:57 PM In reply to

    • Leinweber
    • Top 500 Contributor
    • Joined on 11-17-2011
    • Chicago, Illinois
    • Posts 26

    Re: Delete row from a repeating table using QRules

    Doing some reading and realize the Delete command will not remove the record from the SharePoint list, just from the XML node and that I need to work with RefreshSharePointListItem to do what I want.

     However, I am lost. I am not able get the a SharePoint list item to get removed and no error, result or success indicators are being generated. I don't know if the trouble is my xpath Delete call or in my use of RefreshSharePointList. How can I debug this? I don't know how to tell f the xpath delete is working or not ... or if the RefreshSharePointList call is working or not. What can I do to figure this out?

  • 01-15-2012 08:09 AM In reply to

    Re: Delete row from a repeating table using QRules

    Hi Leinweber, According to an email from Hilary: "in general, use the refresh command on form open, the delete command to remove the list item from the form (or just delete the row) then the SubmitToSharePointList command to actually delete from the list. This user may not be submitting again. Refresh creates a list of all your current linked items so that Submit knows what to delete. " One of us should be able to respond in further detail (or give a demo) sometime next week. Thanks, P
    Patrick Halstead
    Project Manager at Qdabra
  • 01-16-2012 08:20 AM In reply to

    Re: Delete row from a repeating table using QRules

    Hi - just so you know, the SubmitToSharePointList and the companion refresh command are only for use on the Main data source. That means you'd need to copy the SharePoint items into your form's main data source.

    So, you could add a repeating group to your main data source and use the CopyTable to copy in the information from the 2DS. Include the IDs, since the refresh command and the submit command will need them in order to know what item you want to delete or update.

    Then, after you've copied your items in, running the Refresh command will generate the internal list that Patrick mentions. Allow users to delete, update or add items, and the SubmitToSharePointList command will replicate those changes in your SharePoint list. Hope that helps, please let me know where you could use more info.

    Hilary Stoupa

  • 01-17-2012 01:55 PM In reply to

    • Leinweber
    • Top 500 Contributor
    • Joined on 11-17-2011
    • Chicago, Illinois
    • Posts 26

    Re: Delete row from a repeating table using QRules

    Thank you Hilary and Patrick! I understand know and was able to get everything to work.  :)  I greatly appreciate your help with this.

  • 01-17-2012 02:03 PM In reply to

    Re: Delete row from a repeating table using QRules

    That's great news - I'm glad you got it all working the way you want it to!

    Hilary Stoupa

  • 03-19-2014 05:37 AM In reply to

    • cawboy
    • Not Ranked
    • Joined on 03-19-2014
    • Posts 1

    Re: Delete row from a repeating table using QRules

    Hi

    where i must insert this command ?

    concat("Delete /xpath=/my:path/my:to/my:repeatingGroup[", count(preceding-sibling::my:repeatingGroup) + 1, "]")

    for delete an item with infopath form 2010
    Jimmy:

    Assuming you have the delete button in each row of the repeating table, it would be something like:

    concat("Delete /xpath=/my:path/my:to/my:repeatingGroup[", count(preceding-sibling::my:repeatingGroup) + 1, "]")

  • 12-21-2018 05:02 PM In reply to

    Re: Delete row from a repeating table using QRules

    Is it possible to delete a given row from outside the repeating table using QRules?

    I would like to delete all blank rows of a table using a button that is outside the table. I know the SetValue command can use a criterion filter, is it possible to do the same with the Delete command?

    What I am trying is this:
    Delete /xpath=/my:myFields/my:PopulatedData/my:Prod_Info_Display/my:DeleteRow[../my:PN_Display='']

    The first time I press the Button the Success box is checked, but nothing seems to happen. On the second press I receive the error: Could not locate field to delete.

    I can delete the entire table with:
    Delete /xpath=/my:myFields/my:PopulatedData/my:Prod_Info_Display

    Or a specific row with:
    Delete /xpath=/my:myFields/my:PopulatedData/my:Prod_Info_Display[3]

    But I can't figure out how to delete a row when it is blank from outside of the repeating table. Any help is greatly appreciated!
  • 12-31-2018 07:58 AM In reply to

    Re: Delete row from a repeating table using QRules

    So - the repeating group is Prod_Info_Display? I'm not sure what your DeleteRow field is for, but if Prod_Info_Display is the repeating group, and you want to delete rows where PN_Display is blank, I'd try: Delete /xpath=/my:myFields/my:PopulatedData/my:Prod_Info_Display[my:PN_Display='']
    Hilary Stoupa

  • 01-02-2019 10:33 AM In reply to

    Re: Delete row from a repeating table using QRules

    Hi Hillary,

    Thank you for help. That did the trick. I figured my xpath was off.

    When I ran into trouble deleting the rows based on empty fields I tried setting the field DeleteRow to the word "DELETE" and then using a rule to delete the specific row. Which works sort of, but based on order of operations for rules and code it will only delete a single row with each button press.

    Thanks again for all your help!

    Happy New Year!

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