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:
-
"New_Item": This field is a textbox that the user can freely type "Item_Numbers" into.
-
"Validator": This field is a read-only textbox. Its default value is the "Item_Number" field in the secondary data source.
-
This field is filtered by the "New_Item" field.
-
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
-
If the "Validator" field is not blank it throws a validation error (validation rule triggered when the field is not blank)
-
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!