Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / January 2006

Tip: Looking for answers? Try searching our database.

validate unique values across repeating groups

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Will - 13 Jan 2006 17:52 GMT
I often want to validate that a certain attribute or child element is
unique across repeating groups.  Based on information from previous
threads, I was able to accomplish this by creating a validation
condition on the uniqueField control:

". = ../preceding-sibling::groupName/uniqueField or
. = ../following-sibling::groupName/uniqueField"

This works okay.  However, I run across the following problem:

I set uniqueField to "01" on row A.  Then I set uniqueField to "01" on
row B.  This triggers the validation error on uniqueField of row B.
Now if I go back and change uniqueField to "02" on row A, the error
(red outline) on row B remains.  To remove the error, I must change
uniqueField on row B to something else, then change it back to "01" to
retrigger the validation.

Does anyone know a way to enforce this validation in a more global
manner (without adding too much complexity)?

Thanks,
Will
Greg Collins [InfoPath MVP] - 17 Jan 2006 00:48 GMT
Unfortunately, you've just enetered the world of complexity :o).

I've tried doing the same thing many times. InfoPath watches errors in one direction, not two. Thus the situation you run into where if you update the "wrong" field, the error doesn't go away.

An alternative do using data validation is to do all of this in code. It might be a little more work up front, but you can fine tune it much easier to accomplish what you want. The code would add or delete errors as necessary and can make sure that both fields are appropriately udpated.

Signature

Greg Collins [InfoPath MVP]
Visit http://www.InfoPathDev.com

I often want to validate that a certain attribute or child element is
unique across repeating groups.  Based on information from previous
threads, I was able to accomplish this by creating a validation
condition on the uniqueField control:

". = ../preceding-sibling::groupName/uniqueField or
. = ../following-sibling::groupName/uniqueField"

This works okay.  However, I run across the following problem:

I set uniqueField to "01" on row A.  Then I set uniqueField to "01" on
row B.  This triggers the validation error on uniqueField of row B.
Now if I go back and change uniqueField to "02" on row A, the error
(red outline) on row B remains.  To remove the error, I must change
uniqueField on row B to something else, then change it back to "01" to
retrigger the validation.

Does anyone know a way to enforce this validation in a more global
manner (without adding too much complexity)?

Thanks,
Will
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.