preventing duplicate values in a repeatable section - InfoPath Dev
in

InfoPath Dev

preventing duplicate values in a repeatable section

Last post 05-20-2010 11:24 PM by Aruna Akella. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 05-20-2010 02:42 AM

    preventing duplicate values in a repeatable section

    Hi guys,

     I'm have some difficulties with my infopath form.  I want to produce an XML file with the output based on a well defined XSD.

     Basically the issue is that I have a structure like this:

    <xs:element name="Profiles">

    <xs:complexType>

    <xs:sequence>

    <xs:element ref="Profile" minOccurs="1" maxOccurs="unbounded"/>

    </xs:sequence>

    </xs:complexType>

    </xs:element>

    <xs:element name="Profile">

    <xs:complexType>

    <xs:sequence>

    <xs:element ref="Nodes" minOccurs="0" maxOccurs="1"/>

    </xs:sequence>

    </xs:complexType>

    </xs:element>

    <xs:element name="Nodes">

    <xs:complexType>

    <xs:sequence>

    <xs:element ref="Node" minOccurs="1" maxOccurs="unbounded"/>

    </xs:sequence>

    </xs:complexType>

    </xs:element>

    <xs:element name="Node">

    <xs:complexType>

    <xs:attribute name="basePort" use="required" type="xs:string"/>

    <xs:attribute name="hostName" use="required" type="xs:string"/>

    <xs:attribute name="name" use="prohibited" type="xs:string"/>

    </xs:complexType>

    </xs:element>

     

    A Profile should be able to have multiple Node elements, but the hostName attribute for each should be unique.  I've added the following Data Validation rule to the hostName field in my form, but its seems to evaluate that I have multiple entries for hostName, not whether they are the same value:

    count(/Profiles/Profile/Nodes/Node[@hostName = /descendant-or-self::node()/@hostName]) > 1

    Has anyone got any ideas of how I can prevent the hostNames for a Profile from being duplicated ?

    regards,

    Trevor

  • 05-20-2010 07:39 AM In reply to

    Re: preventing duplicate values in a repeatable section

    Can you go through this post? - and see if it helps you.. Definitely you cannot copy the rule, but see if you can modify and make it work for your repeating section.

     
    Aruna Akella
    Qdabra® Software / InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™
  • 05-20-2010 10:15 AM In reply to

    Re: preventing duplicate values in a repeatable section

    Rules can be copied in ShP 2010. One of the cool new features! :)

    Patrick Halstead
    Project Manager at Qdabra
  • 05-20-2010 07:17 PM In reply to

    Re: preventing duplicate values in a repeatable section

    Thanks for taking a look.  I know about the preceding tag, but it only applies to one preceding sibling as I understand it.  Is there a way to the comparison for multiple fields ?

  • 05-20-2010 10:32 PM In reply to

    Re: preventing duplicate values in a repeatable section

    check attachment

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 05-20-2010 11:22 PM In reply to

    Re: preventing duplicate values in a repeatable section

    That is a little bit of genius Qazi.  Thanks :)

  • 05-20-2010 11:24 PM In reply to

    Re: preventing duplicate values in a repeatable section

    Preceding means it contains all nodes that are before the context node in document order. Look at my previous post link where I did something similar to what you asked - but you need to modify the rule to make it work for the repeating section.

    Hope that helps!

    Aruna Akella
    Qdabra® Software / InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.