How to validate if an element within a repeating table is unique

I

IT PHYTOSAN

This should be straight forward but I am struggling. I have a simple one
table data base connection to "shipments" When someone enters a new
shipmentID I'd like to make sure that it is unique within the shipments
displayed in a repeating table (not necesarily all shipments in the database)

My XPATH expression to validate is: count(\\Shimpent\@ShipmentID[.]) >1 but
it does not seem to return the right results.

Thanks for your help

IT PHYTOSAN
 
G

Greg Collins [InfoPath MVP]

Your slashes are in the wrong direction, and you need the current() function.

See if this works any better: count(//Shimpent/@ShipmentID[. = current()/@ShipmentID]) >1
 
I

IT PHYTOSAN

Thank you very much for your help.

Per your advice I have changed the expression. Please note that I am using
actual fields and not those used in the previous example. Embarque are
shipments and AndenIDMuestreo are loading docks.

count(//Embarque/@AndenIDMuestreo[. = current()/@AndenIDMuestreo]) > 1

Upon loading the form I get the following error:

The form definition (.xsf) file contains the following error:

Illegal "expression" expression:
self::node()[count(//Embarque/@AndenIDMuestreo[. =
current()/@AndenIDMuestreo]) > 1]
Unknown method.

self::node()[count(//Embarque/@AndenIDMuestreo[. =
-->current()<--/@AndenIDMuestreo]) > 1]

Please note that I am using IP2007 Beta 2

Thanks for your help

IT PHYTOSAN
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top