Prevent empty values from saving to a SharePoint List using qrules - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Prevent empty values from saving to a SharePoint List using qrules

Last post 03-27-2014 07:23 AM by RajInfoDev. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 03-21-2014 11:54 AM

    Prevent empty values from saving to a SharePoint List using qrules

    I have configured the qrules mapping for a simple InfoPath form to 2 SharePoint lists.

    I have 2 repeating tables on the form mapped to 2 separate SP lists using qrules. It saves form data correctly for the first mandatory repeating table to the first list.

    The second repeating table is optional and has no values by default for its dropdowns.

    But, when I click save, qrules saves the empty dropdown selection as an empty row in the second SharePoint list. How can I prevent this from happening?

    The dropdown data is from data connections so default values cannot be set.

    Any help is much appreciated. Thanks.

  • 03-23-2014 08:39 PM In reply to

    Re: Prevent empty values from saving to a SharePoint List using qrules

    Hi Raj,

    You can do this in two ways:

    1. Before submit, delete empty rows in your second repeating table, i.e. rows whose dropdown fields are blank. You would use the qRules Delete command - here's an example of a command syntax: Delete /xpath=/my:myFields/my:Group2/my:RepeatingGroup2[my:Dropdown = ""]
    2. Add a conditional expression in your mapping - you'd use the opposite of the condition above, i.e. map only rows whose dropdown fields are not blank, e.g. /my:myFields/my:Group2/my:RepeatingGroup2[my:Dropdown != ""] If you're using the InfoPath to SharePoint List Tool to create your mapping file, the conditional expression goes in the textbox underneath the "Data is from a repeating group" check box.

    Hope that makes sense. Let me know if you need more details.

    Regards,

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

  • 03-24-2014 05:43 AM In reply to

    Re: Prevent empty values from saving to a SharePoint List using qrules

    Thank you Mel. The second approach is exactly what I wanted.

    Update: I tried the solution from Mel above and it works.

    But, the problem is that if there is only row in the repeating table and, if its deleted & the form is saved, qRules doesn't delete the corresponding row from the SharePoint list. If there is more than 1 row, deleting a row in the form deletes the row from the list as well.

    I have RefreshSharePointListItems rule for the form.

  • 03-26-2014 03:31 AM In reply to

    Re: Prevent empty values from saving to a SharePoint List using qrules

    In order for qRules to know which item to update/refresh in your SharPoint list, it needs to know the list item ID. So you'd want to make sure that your rows have the corresponding ShP list ID.

    Are you using a full version of qRules (not relevant but just wanted to know)? Can you attach your form here so I can take a quick look?

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

  • 03-27-2014 07:23 AM In reply to

    Re: Prevent empty values from saving to a SharePoint List using qrules

    Unfortunately I wouldn't be able to share the form with you as it contains some confidential information.

     All rows in the list have an item ID. I don't have any problems with update or refresh of data.

     I am specifically having problems when a default(first) row of a repeating table is deleted on the form, but not from the associated SharePoint list, although its mapped using QRules. Deletion of second, third etc... works. Problem is only with the first default row. The record remains in the SharePoint list. Is this a bug with QRules?

    Yes, I have the full version of QRules.

    Can you help? Thanks.

    Update: For anyone else who has a similar problem, I resolved this by recreating the qrules mappings for all the Sharepoint lists using the InfoPath filler. Now, deletes are going through without any problem. Mel's validation solution above also works. Thanks.

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