Creating a Unique Filter - InfoPath Dev
in

InfoPath Dev

Creating a Unique Filter

Last post 11-22-2007 04:35 AM by Joshie777. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 11-20-2007 05:16 AM

    Creating a Unique Filter

    I am trying to create cascading dropdowm boxes. 

    I saw a nice tute on the forum with this but here is the problem I am faced with:

     The sample code on the site is:
    SAMPLE on Site:
    <?xml version="1.0" encoding="UTF-8"?>
    <Vehicles>
        <Vehicle year="1963" make="Chevrolet" model="Corvette"/>
        <Vehicle year="1963" make="Chevrolet" model="Nova"/>
        <Vehicle year="1963" make="Porsche" model="356"/>
        <Vehicle year="1963" make="Porsche" model="Carrera"/>
        <Vehicle year="1973" make="Ford" model="Bronco"/>
        <Vehicle year="1973" make="Ford" model="Mustang"/>

    SAMPLE Changes I made to data to reflect my data:
     
    <?xml version="1.0" encoding="UTF-8"?>
    <arp>
        <Division name="Refining" department="GM-Refining" costcentre="40000"/>
        <Division name="Refining" department="GM-Refining" costcentre="40100"/>
        <Division name="Refining" department="GM-Refining" costcentre="47200"/>
        <Division name="Refining" department="GM-Refining" costcentre="49220"/>
        <Division name="Refining" department="Heavy Oils/Conversion" costcentre="42000"/>
        <Division name="Refining" department="Heavy Oils/Conversion" costcentre="42010"/>\
    <Division name="Marketing and Trading" department="Crude Purchasing" costcentre="53200"/>
     <Division name="Marketing and Trading" department="GM-Marketing and Trading" costcentre="53000"/>
     <Division name="Marketing and Trading" department="GM-Marketing and Trading" costcentre="53400"/>
     <Division name="Marketing and Trading" department="Port Operations" costcentre="41010"/>
     
    Now I created the three dropdown fields (name, department and costcentre) and followed the tutorial to make a cascading dropdown.  The name field filtered great... and the cost centre as well, but somehow the Expression they have for the middle field, which in my case is the department field, is not working, it still shows GM-Refining (4times) and Heavy Oils (2 times etc.)  and its a lot of data, I just sent you a sample, but the truth is, all of the departments are displayed in the dropdown, all the way down, and not filtered for unique records, whereas in the name field Refining is filtered and Marketing & Trading. is also filtered as showing up only once.  This field works great..


    This is the Expression from the tutorial to filter the department field, but it does not seem to work...
     
    /arp/Division/@department[(../@name = xdXDocument:get-DOM()/dfs:myFields/my:Division/my:Name) and (not(. = ../preceding-sibling::Division[@Name = current()/my:Division/my:name]/@dept))]

     

    Any assistance to show me how to filter the department field will be greatly appreciated.  Thanks..

  • 11-21-2007 08:34 AM In reply to

    Re: Creating a Unique Filter

    Hi joshie777,

    These filters are very difficult to debug.  I would really have to see your schema to give better advice, but I would take the first clause out (before the and).  It seems unecessary and will cause the expression to evaluate to true more often than you like.

    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 11-22-2007 04:35 AM In reply to

    Re: Creating a Unique Filter

    Thanks... Actually, I was looking at another solution close to this in the forum with someone who had a similar problem.  The response was to make sure that the fields in the main datasource and the secondary data source have the same format, eg. capital letters / common letters.  My problem was that one of my fields had a common letter where a capital was supposed to be.  When I made the change, all went well.  All of my three cascading drop downs work perfect.  Thanks for all your assistance.

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