Check if a field value is contained in a secondary data source - InfoPath Dev
in

InfoPath Dev

Check if a field value is contained in a secondary data source

Last post 09-25-2013 06:38 AM by Shrout1. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 09-24-2013 10:42 AM

    Check if a field value is contained in a secondary data source

    I have a field that reaches into a database and pulls out some line item numbers; they are placed into a combo box. I'd like to make a separate field (that I can type into) that will give me an error if the value I type matches one of those line items (i.e an entry already contained within the combo box). Something like, "This item already exists". Any way to do that with an XPath expression in a validation rule?

  • 09-25-2013 06:38 AM In reply to

    Re: Check if a field value is contained in a secondary data source

    Thought of the solution while I was falling asleep last night; was sure to write it down!

    Look at the attached XSN file; it serves as a direct example how to accomplish this if my explanation is not clear.

    In the attached file I use a repeating group as the data source (rather than a secondary data source) since anyone will easily be able to recreate it. I use two fields to accomplish this validation rule:

    1. "New_Item": This field is a textbox that the user can freely type "Item_Numbers" into.
    2. "Validator": This field is a read-only textbox. Its default value is the "Item_Number" field in the secondary data source.
      1. This field is filtered by the "New_Item" field.
      2. If the "New_Item" field has an "Item_Number" entered into it that matches one in the secondary data source the "Validator" field will no longer be blank
      3. If the "Validator" field is not blank it throws a validation error (validation rule triggered when the field is not blank)
      4. If the "Validator" field is not blank then a section with a warning message is no longer hidden and the user is notified that the field already exists.

    The idea here is that the form would feed back into the secondary data source and that each new "Item_Number" would become part of the secondary data source when the form is submitted. At this stage the form is not designed to be submitted, but is a proof of concept as to how one would execute this filter.

     I hope this helps someone!

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